Ejemplo n.º 1
0
        public void WhenAddingMockBehaviorToObject_ThenCanAddInterface()
        {
            object mock = new TestMock();

            mock.AddBehavior(new TestMockBehavior());

            Assert.Equal(1, ((IMocked)mock).Mock.Behaviors.Count);
        }
Ejemplo n.º 2
0
        public void WhenAddingMockBehaviorToObject_ThenCanAddLambda()
        {
            object mock = new TestMock();

            mock.AddBehavior(m => true, (m, n) => null);

            Assert.Equal(1, ((IMocked)mock).Mock.Behaviors.Count);
        }
Ejemplo n.º 3
0
        public void WhenAddingMockBehavior_ThenCanAddInterface()
        {
            var mock = new TestMock();

            mock.AddBehavior(new TestMockBehavior());

            Assert.Equal(1, mock.Mock.Behaviors.Count);
        }
Ejemplo n.º 4
0
        public void WhenAddingMockBehavior_ThenCanAddLambda()
        {
            var mock = new TestMock();

            mock.AddBehavior(m => true, (m, n) => null);

            Assert.Equal(1, mock.Mock.Behaviors.Count);
        }
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 6
0
        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]);
        }
Ejemplo n.º 7
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]);
        }