public void WhenAddingMockBehaviorToObject_ThenCanAddLambda() { object mock = new TestMock(); mock.AddMockBehavior(m => true, (m, n) => null); Assert.Equal(1, ((IMocked)mock).Mock.Behaviors.Count); }
public void WhenAddingMockBehaviorToObject_ThenCanAddInterface() { object mock = new TestMock(); mock.AddMockBehavior(new TestMockBehavior()); Assert.Equal(1, ((IMocked)mock).Mock.Behaviors.Count); }
public void WhenAddingMockBehavior_ThenCanAddInterface() { var mock = new TestMock(); mock.AddMockBehavior(new TestMockBehavior()); Assert.Equal(1, mock.Mock.Behaviors.Count); }
public void WhenAddingMockBehavior_ThenCanAddLambda() { var mock = new TestMock(); mock.AddMockBehavior(m => true, (m, n) => null); Assert.Equal(1, mock.Mock.Behaviors.Count); }
public void WhenInsertingMockBehaviorToObject_ThenCanAddLambda() { object mock = new TestMock(); mock.AddMockBehavior(m => true, (m, n) => null); mock.InsertMockBehavior(0, m => true, (m, n) => throw new NotImplementedException()); Assert.Equal(2, ((IMocked)mock).Mock.Behaviors.Count); Assert.Throws <NotImplementedException>(() => ((IMocked)mock).Mock.Behaviors[0].Invoke(null, null)); }
public void InitializePropertyTo5() { var mock = new Mock <TestMock>(); mock.SetupProperty(testMock => testMock.TestProperty, 5); TestMock _mock = mock.Object; Assert.Equal(5, _mock.TestProperty); }
public void WhenInsertingMockBehavior_ThenCanAddLambda() { var mock = new TestMock(); mock.AddBehavior(m => true, (m, n) => null); mock.InsertBehavior(0, m => true, (m, n) => throw new NotImplementedException()); Assert.Equal(2, mock.Mock.Behaviors.Count); Assert.Throws <NotImplementedException>(() => mock.Mock.Behaviors[0].Invoke(null, null)); }
public void WhenInsertingMockBehaviorToObject_ThenCanAddInterface() { object mock = new TestMock(); var behavior = new TestMockBehavior(); mock.AddMockBehavior(m => true, (m, n) => null); mock.InsertMockBehavior(0, behavior); Assert.Equal(2, ((IMocked)mock).Mock.Behaviors.Count); Assert.Same(behavior, ((IMocked)mock).Mock.Behaviors[0]); }
public void WhenInsertingMockBehavior_ThenCanAddInterface() { var mock = new TestMock(); var behavior = new TestMockBehavior(); mock.AddMockBehavior(m => true, (m, n) => null); mock.InsertMockBehavior(0, behavior); Assert.Equal(2, mock.Mock.Behaviors.Count); Assert.Same(behavior, mock.Mock.Behaviors[0]); }
public void MockBuilder_Create_Key_Null() { // arrange var key = (string)null; // act var builder = TestMock.Create(key); var value = builder.Build(); // assert var valueExpected = GetValue(key); builder.Key.Should().Be(key); builder.Value.Should().BeEquivalentTo(valueExpected); value.Should().BeEquivalentTo(valueExpected); value.Should().Be(builder.Value); }