Exemplo n.º 1
0
            public void DoesNotIgnoreValueTypesIfIgnoreValueTypesIsFalse()
            {
                var firstType = new TypeRequestInfo(typeof(X));
                var path      = new TypeRequestPath(firstType, false);

                path.PushType(new TypeRequestInfo(typeof(DateTime)), false);
                Assert.AreEqual(typeof(DateTime), path.LastType.Type);

                path.PushType(new TypeRequestInfo(typeof(double)), false);
                Assert.AreEqual(typeof(double), path.LastType.Type);

                path.PushType(new TypeRequestInfo(typeof(int)), false);
                Assert.AreEqual(typeof(int), path.LastType.Type);
            }
Exemplo n.º 2
0
            public void RemovesTypeRangeUntilSpecificType()
            {
                var path = new TypeRequestPath(new TypeRequestInfo(typeof(X)));

                path.PushType(new TypeRequestInfo(typeof(object)), false);
                path.PushType(new TypeRequestInfo(typeof(Y)), false);
                path.PushType(new TypeRequestInfo(typeof(object)), false);
                path.PushType(new TypeRequestInfo(typeof(Z)), false);

                path.MarkTypeAsNotCreated(new TypeRequestInfo(typeof(Y)));

                Assert.AreEqual(2, path.TypeCount);
                Assert.AreEqual(new TypeRequestInfo(typeof(X)), path.AllTypes[0]);
                Assert.AreEqual(new TypeRequestInfo(typeof(object)), path.AllTypes[1]);
            }
Exemplo n.º 3
0
            public void DoesNotThrowCircularDependencyExceptionForDuplicateTypeIfNotSpecified()
            {
                var typeArray = CreateMixedArray();
                var path      = new TypeRequestPath(typeArray);

                path.PushType(new TypeRequestInfo(typeof(X)), false);

                Assert.IsFalse(path.IsValid);
            }
Exemplo n.º 4
0
            public void DoesThrowCircularDependencyExceptionForDuplicateTypeIfSpecified()
            {
                var typeArray = CreateMixedArray();
                var path      = new TypeRequestPath(typeArray);

                ExceptionTester.CallMethodAndExpectException <CircularDependencyException>(() => path.PushType(new TypeRequestInfo(typeof(X)), true));
            }
Exemplo n.º 5
0
            public void ThrowsArgumentNullExceptionForNullTypeRequestInfo()
            {
                var typeArray = CreateMixedArray();
                var path      = new TypeRequestPath(typeArray);

                ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => path.PushType(null, false));
            }