public void WhenInsertingMockBehaviorToObject_ThenCanAddLambda() { object mock = new TestMock(); mock.AddBehavior(m => true, (m, n) => null); mock.InsertBehavior(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 WhenInsertingMockBehaviorToObject_ThenCanAddInterface() { object mock = new TestMock(); var behavior = new TestMockBehavior(); mock.AddBehavior(m => true, (m, n) => null); 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 TestMock(); var behavior = new TestMockBehavior(); mock.AddBehavior(m => true, (m, n) => null); mock.InsertBehavior(0, behavior); Assert.Equal(2, mock.Mock.Behaviors.Count); Assert.Same(behavior, mock.Mock.Behaviors[0]); }