We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi!
LightMock can't change arrangements? Like this:
public class ArrangementTests { //... [Fact] public void Arrange_ChangeReturnValue() { var mockContext = new MockContext<IFoo>(); var fooMock = new FooMock(mockContext); mockContext.Arrange(f => f.Execute()).Returns("1"); Assert.Equal("1", fooMock.Execute()); mockContext.Arrange(f => f.Execute()).Returns("2"); Assert.Equal("2", fooMock.Execute()); } [Fact] public void Arrange_ChangeCallback() { int firstResult = 0; int secondResult = 0; var mockContext = new MockContext<IFoo>(); var fooMock = new FooMock(mockContext); mockContext.Arrange(f => f.Execute(The<int>.IsAnyValue)).Callback<int>(i => firstResult = i); fooMock.Execute(1); mockContext.Arrange(f => f.Execute(The<int>.IsAnyValue)).Callback<int>(i => secondResult = i); fooMock.Execute(2); Assert.Equal(1, firstResult); Assert.Equal(2, secondResult); } [Fact] public void Arrange_ChangeException() { var mockContext = new MockContext<IFoo>(); var fooMock = new FooMock(mockContext); mockContext.Arrange(f => f.Execute(The<int>.IsAnyValue)).Throws<System.ArgumentNullException>(); Assert.Throws<System.ArgumentNullException>(() => fooMock.Execute(1)); mockContext.Arrange(f => f.Execute(The<int>.IsAnyValue)).Throws<System.ArgumentOutOfRangeException>(); Assert.Throws<System.ArgumentOutOfRangeException>(() => fooMock.Execute(1)); } [Fact] public void Arrange_SimulatousReturnAndCallback() { string firstResult = ""; var mockContext = new MockContext<IFoo>(); var fooMock = new FooMock(mockContext); mockContext.Arrange(f => f.Execute(The<string>.IsAnyValue)).Returns("hi"); mockContext.Arrange(f => f.Execute(The<string>.IsAnyValue)).Callback<string>(i => firstResult = i); var result = fooMock.Execute("hello"); Assert.Equal("hi", result); Assert.Equal("hello", firstResult); } }
Tests abowe do not pass. Is this behavior intended? Can it be changed? I can write a pull request that changes this behavior.
Thanks.
The text was updated successfully, but these errors were encountered:
Thanks!
Sorry, something went wrong.
No branches or pull requests
Hi!
LightMock can't change arrangements? Like this:
Tests abowe do not pass. Is this behavior intended? Can it be changed? I can write a pull request that changes this behavior.
Thanks.
The text was updated successfully, but these errors were encountered: