Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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]);
        }
Exemplo n.º 3
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]);
        }