public void WhenAddingMockBehaviorToObject_ThenCanAddLambda() { object mock = new Mocked(); mock.AddBehavior((m, n) => null, m => true); Assert.Equal(1, ((IMocked)mock).Mock.Behaviors.Count); }
public void WhenAddingMockBehaviorToObject_ThenCanAddInterface() { object mock = new Mocked(); mock.AddBehavior(new TestMockBehavior()); Assert.Equal(1, ((IMocked)mock).Mock.Behaviors.Count); }
public void WhenAddingMockBehavior_ThenCanAddLambda() { var mock = new Mocked(); mock.AddBehavior((m, n) => null, m => true); Assert.Equal(1, mock.Mock.Behaviors.Count); }
public void WhenAddingMockBehavior_ThenCanAddInterface() { var mock = new Mocked(); mock.AddBehavior(new TestMockBehavior()); Assert.Equal(1, mock.Mock.Behaviors.Count); }
public void WhenAddingMockBehavior_ThenCanAddInterface() { var mock = new Mocked(); mock.AddBehavior(new TestMockBehavior()); Assert.Single(mock.Mock.Behaviors); }
public void WhenAddingMockBehavior_ThenCanAddLambda() { var mock = new Mocked(); mock.AddBehavior((m, n) => null, m => true); Assert.Single(mock.Mock.Behaviors); }
public void WhenAddingMockBehavior_ThenCanAddInterface() { var mock = new Mocked(); var behavior = new TestMockBehavior(); mock.AddBehavior(behavior); Assert.Contains(behavior, mock.Mock.Behaviors); }
public void RecordsInvocation() { var behavior = new MockTrackingBehavior(); var mock = new Mocked(); behavior.Invoke(new MethodInvocation(mock, typeof(object).GetMethod(nameof(object.ToString))), () => (m, n) => m.CreateValueReturn(null)); Assert.Equal(1, mock.Mock.Invocations.Count); }
public void WhenInsertingMockBehaviorToObject_ThenCanAddLambda() { object mock = new Mocked(); mock.AddBehavior((m, n) => null, m => true); mock.InsertBehavior(0, (m, n) => throw new NotImplementedException(), m => true); Assert.Equal(2, ((IMocked)mock).Mock.Behaviors.Count); Assert.Throws <NotImplementedException>(() => ((IMocked)mock).Mock.Behaviors[0].Invoke(null, null)); }
public void WhenInsertingMockBehavior_ThenCanAddLambda() { var mock = new Mocked(); mock.AddBehavior((m, n) => null, m => true); mock.InsertBehavior(0, (m, n) => throw new NotImplementedException(), m => true); Assert.Equal(2, mock.Mock.Behaviors.Count); Assert.Throws <NotImplementedException>(() => mock.Mock.Behaviors[0].Execute(null, null)); }
public void WhenInsertingMockBehaviorToObject_ThenCanAddInterface() { object mock = new Mocked(); var behavior = new TestMockBehavior(); mock.AddBehavior((m, n) => null, m => true); mock.InsertBehavior(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 Mocked(); var behavior = new TestMockBehavior(); var count = mock.GetMock().Behaviors.Count; mock.AddBehavior((m, n) => null, m => true); mock.InsertBehavior(0, behavior); Assert.Equal(count + 2, mock.Mock.Behaviors.Count); Assert.Same(behavior, mock.Mock.Behaviors[0]); }