public void detect_cicle_with_three_types()
        {
            var typeA = new AliasTypeDeclarationNode
                {
                    ExistingType = new TypeReferenceNode
                        {
                            TypeName = "b"
                        },
                    Name = new TypeIdentifierNode
                        {
                            Name = "a"
                        }
                };
            var typeB = new AliasTypeDeclarationNode
                {
                    ExistingType = new TypeReferenceNode
                        {
                            TypeName = "c"
                        },
                    Name = new TypeIdentifierNode
                        {
                            Name = "b"
                        }
                };
            var typeC = new AliasTypeDeclarationNode
                {
                    ExistingType = new TypeReferenceNode
                        {
                            TypeName = "a"
                        },
                    Name = new TypeIdentifierNode
                        {
                            Name = "c"
                        }
                };
            var types = new[] {typeA, typeB, typeC};

            var target = new CircularTypeReferencesError(types, SourceLocation.Invalid);

            Assert.IsTrue(target.IsActive);
        }
        public void use_type_defined_below()
        {
            var typeA = new AliasTypeDeclarationNode
                {
                    ExistingType = new TypeReferenceNode
                        {
                            TypeName = "b"
                        },
                    Name = new TypeIdentifierNode
                        {
                            Name = "a"
                        }
                };
            var typeB = new AliasTypeDeclarationNode
                {
                    ExistingType = new TypeReferenceNode
                        {
                            TypeName = "int"
                        },
                    Name = new TypeIdentifierNode
                        {
                            Name = "b"
                        }
                };
            var types = new[] {typeA, typeB};

            var target = new CircularTypeReferencesError(types, SourceLocation.Invalid);

            CollectionAssert.AreEqual(new[] {typeB, typeA}, target.OrderedTypes);
            Assert.IsFalse(target.IsActive);
        }
        public void returns_types_not_involved_in_cicle()
        {
            var typeA = new AliasTypeDeclarationNode
                {
                    ExistingType = new TypeReferenceNode
                        {
                            TypeName = "b"
                        },
                    Name = new TypeIdentifierNode
                        {
                            Name = "a"
                        }
                };
            var typeB = new AliasTypeDeclarationNode
                {
                    ExistingType = new TypeReferenceNode
                        {
                            TypeName = "a"
                        },
                    Name = new TypeIdentifierNode
                        {
                            Name = "b"
                        }
                };
            var typeC = new AliasTypeDeclarationNode
                {
                    ExistingType = new TypeReferenceNode
                        {
                            TypeName = "int"
                        },
                    Name = new TypeIdentifierNode
                        {
                            Name = "c"
                        }
                };
            var types = new[] {typeA, typeB, typeC};

            var target = new CircularTypeReferencesError(types, SourceLocation.Invalid);

            CollectionAssert.AreEqual(new[] {typeC}, target.OrderedTypes);
            Assert.IsTrue(target.IsActive);
        }