예제 #1
0
        public void ContainerAdd_Smth_AddedOne()
        {
            var container = new MiddlewareContainer();

            container.Add(new MiddlewareDescription());

            Assert.Equal(container.Pairs.Count, 1);
        }
예제 #2
0
        public void ContainerAdd_FourMiddlewares_FourPairs()
        {
            var container = new MiddlewareContainer();

            container.AddWithTerms <Second>(new[] { typeof(First) }, new[] { typeof(Third) });
            container.Add <First>();
            container.Add <Third>();
            container.Add <Fourth>();

            Assert.Equal(container.Pairs.Count, 4);
        }
예제 #3
0
        public void GetSorted_OneTwoThreeExpected()
        {
            MiddlewareContainer container = new MiddlewareContainer();

            container.Add(MiddlewareDescription.Create <Second>().Before <Third>().After <First>());
            container.Add(MiddlewareDescription.Create <First>());
            container.Add(MiddlewareDescription.Create <Third>());

            var result = container.GetSorted();

            Assert.Equal(result[0].Type, typeof(First));
            Assert.Equal(result[1].Type, typeof(Second));
            Assert.Equal(result[2].Type, typeof(Third));
        }
예제 #4
0
        public void ContainerAdd_Null_ThrowsException()
        {
            var container = new MiddlewareContainer();

            Assert.Throws <ArgumentNullException>(() => container.Add(null));
        }
예제 #5
0
        public void ContainerCreate_ContructorsWorks()
        {
            MiddlewareContainer container = new MiddlewareContainer();

            container = new MiddlewareContainer(Enumerable.Empty <MiddlewareDescription>());
        }