Beispiel #1
0
        public void InputviewEngines_InstancesOf_ReturnsNonEmptyCollectionIfSomeExist()
        {
            // Arrange
            var viewEngines = new MvcOptions().ViewEngines;

            viewEngines.Add(typeof(TestViewEngine));
            var viewEngine1 = new TestViewEngine();
            var viewEngine2 = Mock.Of <IViewEngine>();
            var viewEngine3 = new TestViewEngine();
            var viewEngine4 = Mock.Of <IViewEngine>();

            viewEngines.Add(viewEngine1);
            viewEngines.Add(viewEngine2);
            viewEngines.Add(viewEngine3);
            viewEngines.Add(viewEngine4);

            var expectedviewEngines = new List <TestViewEngine> {
                viewEngine1, viewEngine3
            };

            // Act
            var result = viewEngines.InstancesOf <TestViewEngine>().ToList();

            // Assert
            Assert.NotEmpty(result);
            Assert.Equal(result, expectedviewEngines);
        }
Beispiel #2
0
        public void InputviewEngines_InstancesOf_ReturnsEmptyCollectionIfNoneExist()
        {
            // Arrange
            var viewEngines = new MvcOptions().ViewEngines;

            viewEngines.Add(Mock.Of <IViewEngine>());
            viewEngines.Add(typeof(TestViewEngine));

            // Act
            var result = viewEngines.InstancesOf <TestViewEngine>();

            // Assert
            Assert.Empty(result);
        }
        public void InputviewEngines_InstancesOf_ReturnsNonEmptyCollectionIfSomeExist()
        {
            // Arrange
            var viewEngines = new MvcOptions().ViewEngines;
            viewEngines.Add(typeof(TestViewEngine));
            var viewEngine1 = new TestViewEngine();
            var viewEngine2 = Mock.Of<IViewEngine>();
            var viewEngine3 = new TestViewEngine();
            var viewEngine4 = Mock.Of<IViewEngine>();
            viewEngines.Add(viewEngine1);
            viewEngines.Add(viewEngine2);
            viewEngines.Add(viewEngine3);
            viewEngines.Add(viewEngine4);

            var expectedviewEngines = new List<TestViewEngine> { viewEngine1, viewEngine3 };

            // Act
            var result = viewEngines.InstancesOf<TestViewEngine>().ToList();

            // Assert
            Assert.NotEmpty(result);
            Assert.Equal(result, expectedviewEngines);
        }
        public void InputviewEngines_InstancesOf_ReturnsEmptyCollectionIfNoneExist()
        {
            // Arrange
            var viewEngines = new MvcOptions().ViewEngines;
            viewEngines.Add(Mock.Of<IViewEngine>());
            viewEngines.Add(typeof(TestViewEngine));

            // Act
            var result = viewEngines.InstancesOf<TestViewEngine>();

            // Assert
            Assert.Empty(result);
        }