public void Can_Generate_Class_With_A_Many_Association()
 {
     var types = new List<Type> { typeof(Eagle), typeof(Claw), typeof(Wing) };
     var yuml = new YumlGenerator(types).Yuml();
     Console.WriteLine(yuml);
     Assert.AreEqual("http://yuml.me/diagram/scruffy/class/[Eagle],[Eagle]->[Claw],[Eagle]1-0..*[Wing],[Claw],[Wing]", yuml);
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            string yuml;

            //var foo = typeof(IRoundShape).GetInterfaces();
            //new ToYuml.Test.YumlGeneratorTests().Interface_Inheritance_Chaining();

            Console.WriteLine("Requesting ab...");
            YumlRequest.Request("[A]->[B]", true, "a_b.png");

            Console.WriteLine("Requesting abc...");
            YumlRequest.Request("[A]->[B],[A]^-[C]", false, "abc.png");

            // Oroborous
            Console.WriteLine("Requesting ToYuml...");
            var gen = new YumlGenerator()
                      .AddTypesForAssembly(typeof(YumlRequest))
                      .SearchNonPublicMembers(true)
                      .UseInterfaceInheritance(true);

            yuml = gen.Yuml();
            YumlRequest.Request(yuml, true, "ToYuml.png");

            Console.WriteLine("Requesting ToYuml.Test...");
            gen = new YumlGenerator()
                  .AddTypesForAssembly(typeof(Animal))
                  .UseInterfaceInheritance(true)
                  .SearchNonPublicMembers(true);

            yuml = gen.Yuml();
            YumlRequest.Request(yuml, true, "ToYuml.Test.png");

            Console.WriteLine("Done!");
        }
 public void Random()
 {
     var types = new List<Type>();
     types.AddRange(new AssemblyFilter(typeof(Folder).Assembly).Types);
     var yuml = new YumlGenerator(new AssemblyFilter(typeof(NHibernate.TransientObjectException).Assembly).Types.Where(t => t.Namespace.Contains("Cache")).ToList()).Yuml();
     Console.WriteLine(yuml);
 }
Ejemplo n.º 4
0
 public void Bidirectional_A_TO_B_With_Extraneous_Declaration()
 {
     // this is better than Current_A_TO_B, but [B] and [A] don't
     // need to appear here
     var types = new List<Type> { typeof(A), typeof(B) };
     var yuml = new YumlGenerator(types).Yuml();
     Check("[A]<->[B],[B],[A]", yuml);
 }
Ejemplo n.º 5
0
        public void Does_Not_Duplicate_Base_Classes()
        {
            var types = new List <Type> {
                typeof(Animal), typeof(Bird), typeof(Eagle), typeof(Swallow)
            };
            var yuml = new YumlGenerator(types).Yuml();

            Check("[Animal],[Bird],[Animal]^-[Bird],[Eagle],[Bird]^-[Eagle],[Swallow],[Bird]^-[Swallow]", yuml);
        }
Ejemplo n.º 6
0
        public void Duplicate_Types_Appear_Only_Once()
        {
            var types = new List <Type> {
                typeof(Animal), typeof(Animal)
            };
            var yuml = new YumlGenerator(types).Yuml();

            Check("[Animal]", yuml);
        }
Ejemplo n.º 7
0
        public void Field_Is_Interface()
        {
            var types = new List <Type> {
                typeof(Key), typeof(IShiny)
            };
            var yuml = new YumlGenerator(types).Yuml();

            Check("[Key],[Key]->[<<IShiny>>]", yuml);
        }
Ejemplo n.º 8
0
        public void Enumerable_Field_Is_Interface()
        {
            var types = new List <Type> {
                typeof(Key), typeof(INotch)
            };
            var yuml = new YumlGenerator(types).Yuml();

            Check("[Key],[Key]-0..*>[<<INotch>>]", yuml);
        }
Ejemplo n.º 9
0
 public void Base_Class_Dependencies_Do_Not_Show_In_Derived_Class()
 {
     var types = new List<Type> { typeof(Mass), typeof(Rock), typeof(Igneous) };
     var yuml = new YumlGenerator(types).Yuml();
     // This is odd, because Rock has a property Mass, a field Mass, and a List<Mass>. The process
     // outputs the enumerable first, followed by the single field (since we're not counting actual
     // references here yet)
     Check("[Mass],[Rock],[Rock]-0..*>[Mass],[Igneous],[Rock]^-[Igneous]", yuml);
 }
Ejemplo n.º 10
0
        public void Current_A_TO_B()
        {
            var types = new List <Type> {
                typeof(A), typeof(B)
            };
            var yuml = new YumlGenerator(types).Yuml();

            Check("[A]->[B],[B]->[A],[A],[B]", yuml);
        }
Ejemplo n.º 11
0
        public void Ideal_Bidirectional_A_TO_B()
        {
            var types = new List <Type> {
                typeof(A), typeof(B)
            };
            var yuml = new YumlGenerator(types).Yuml();

            Check("[A]<->[B]", yuml);
        }
Ejemplo n.º 12
0
        public void Bidirectional_One_To_One_Shows_Double_Ended_Arrow()
        {
            var types = new List <Type> {
                typeof(Container), typeof(Component)
            };
            var yuml = new YumlGenerator(types).Yuml();

            Check("[Container]<->[Component]", yuml);
        }
Ejemplo n.º 13
0
        public void Can_Generate_Class_With_A_Many_Association()
        {
            var types = new List <Type> {
                typeof(Eagle), typeof(Claw), typeof(Wing)
            };
            var yuml = new YumlGenerator(types).Yuml();

            Check("[Eagle],[Eagle]-0..*>[Wing],[Eagle]->[Claw],[Claw],[Wing]", yuml);
        }
Ejemplo n.º 14
0
        public void Random()
        {
            var types = new List <Type>();

            types.AddRange(new AssemblyFilter(typeof(Folder).Assembly).Types);
            var yuml = new YumlGenerator(new AssemblyFilter(typeof(NHibernate.TransientObjectException).Assembly).Types.Where(t => t.Namespace.Contains("Cache")).ToList()).Yuml();

            Console.WriteLine(yuml);
        }
Ejemplo n.º 15
0
        public void Can_Generate_Class_With_A_Many_Association()
        {
            var types = new List <Type> {
                typeof(Eagle), typeof(Claw), typeof(Wing)
            };
            var yuml = new YumlGenerator(types).Yuml();

            Console.WriteLine(yuml);
            Assert.AreEqual("http://yuml.me/diagram/scruffy/class/[Eagle],[Eagle]->[Claw],[Eagle]1-0..*[Wing],[Claw],[Wing]", yuml);
        }
Ejemplo n.º 16
0
        public void Interface_Inheritance_TRUE()
        {
            // second way is explicit
            var types = new List <Type> {
                typeof(IAnimalPrey), typeof(Swallow)
            };
            var yuml = new YumlGenerator(types).UseInterfaceInheritance(true).Yuml();

            Check("[<<IAnimalPrey>>],[Swallow],[<<IAnimalPrey>>]^-.-[Swallow]", yuml);
        }
Ejemplo n.º 17
0
        public void Interfaces_Are_Referenced_From_Declaring_Class()
        {
            var types = new[] { typeof(IShape), typeof(Rhombus), typeof(Square) };
            var yuml  = new YumlGenerator(types)
                        .UseInterfaceInheritance(true)
                        .SearchNonPublicMembers(true)
                        .Yuml();

            Check("[<<IShape>>],[Rhombus],[Square],[<<IShape>>]^-.-[Rhombus],[Rhombus]^-[Square]", yuml);
        }
Ejemplo n.º 18
0
        public void Bidirectional_A_TO_B_With_Extraneous_Declaration()
        {
            // this is better than Current_A_TO_B, but [B] and [A] don't
            // need to appear here
            var types = new List <Type> {
                typeof(A), typeof(B)
            };
            var yuml = new YumlGenerator(types).Yuml();

            Check("[A]<->[B],[B],[A]", yuml);
        }
Ejemplo n.º 19
0
        public void Interface_Inheritance_FALSE()
        {
            var types = new List <Type> {
                typeof(Swallow), typeof(IAnimalPrey)
            };

            // first way is inline
            var yuml = new YumlGenerator(types).UseInterfaceInheritance(false).Yuml();

            Check("[<<IAnimalPrey>>;Swallow]", yuml);
        }
Ejemplo n.º 20
0
        public void Interface_Inheritance_Chaining()
        {
            var types = new[] { typeof(IShape), typeof(IRoundShape), typeof(Ellipse) };

            var yuml = new YumlGenerator(types)
                       .UseInterfaceInheritance(true)
                       .SearchNonPublicMembers(true)
                       .Yuml();

            Check("[<<IShape>>],[<<IRoundShape>>],[Ellipse],[<<IShape>>]^-.-[<<IRoundShape>>],[<<IRoundShape>>]^-.-[Ellipse]", yuml);
        }
Ejemplo n.º 21
0
        public void Public_And_Private_Fields()
        {
            var types = new List <Type> {
                typeof(Lock), typeof(Key), typeof(Secret)
            };
            var yuml = new YumlGenerator(types).Yuml();

            Check("[Lock],[Lock]->[Key],[Key],[Secret]", yuml);

            yuml = new YumlGenerator(types).SearchNonPublicMembers(true).Yuml();
            Check("[Lock],[Lock]->[Key],[Lock]->[Secret],[Key],[Secret]", yuml);
        }
Ejemplo n.º 22
0
        public void Base_Class_Dependencies_Do_Not_Show_In_Derived_Class()
        {
            var types = new List <Type> {
                typeof(Mass), typeof(Rock), typeof(Igneous)
            };
            var yuml = new YumlGenerator(types).Yuml();

            // This is odd, because Rock has a property Mass, a field Mass, and a List<Mass>. The process
            // outputs the enumerable first, followed by the single field (since we're not counting actual
            // references here yet)
            Check("[Mass],[Rock],[Rock]-0..*>[Mass],[Igneous],[Rock]^-[Igneous]", yuml);
        }
Ejemplo n.º 23
0
 public void Interface_Inheritance_TRUE()
 {
     // second way is explicit
     var types = new List<Type> { typeof(IAnimalPrey), typeof(Swallow) };
     var yuml = new YumlGenerator(types).UseInterfaceInheritance(true).Yuml();
     Check("[<<IAnimalPrey>>],[Swallow],[<<IAnimalPrey>>]^-.-[Swallow]", yuml);
 }
Ejemplo n.º 24
0
 public void Can_Generate_Class_With_A_Many_Association()
 {
     var types = new List<Type> { typeof(Eagle), typeof(Claw), typeof(Wing) };
     var yuml = new YumlGenerator(types).Yuml();
     Check("[Eagle],[Eagle]-0..*>[Wing],[Eagle]->[Claw],[Claw],[Wing]", yuml);
 }
Ejemplo n.º 25
0
 public void Ideal_Bidirectional_A_TO_B()
 {
     var types = new List<Type> { typeof(A), typeof(B) };
     var yuml = new YumlGenerator(types).Yuml();
     Check("[A]<->[B]", yuml);
 }
Ejemplo n.º 26
0
 public void Interfaces_Are_Referenced_From_Declaring_Class()
 {
     var types = new[] { typeof(IShape), typeof(Rhombus), typeof(Square) };
     var yuml = new YumlGenerator(types)
         .UseInterfaceInheritance(true)
         .SearchNonPublicMembers(true)
         .Yuml();
     Check("[<<IShape>>],[Rhombus],[Square],[<<IShape>>]^-.-[Rhombus],[Rhombus]^-[Square]", yuml);
 }
Ejemplo n.º 27
0
 public void Enumerable_Field_Is_Interface()
 {
     var types = new List<Type> { typeof(Key), typeof(INotch) };
     var yuml = new YumlGenerator(types).Yuml();
     Check("[Key],[Key]-0..*>[<<INotch>>]", yuml);
 }
Ejemplo n.º 28
0
        public void Interface_Inheritance_Chaining()
        {
            var types = new[] { typeof(IShape), typeof(IRoundShape), typeof(Ellipse) };

            var yuml = new YumlGenerator(types)
                .UseInterfaceInheritance(true)
                .SearchNonPublicMembers(true)
                .Yuml();
            Check("[<<IShape>>],[<<IRoundShape>>],[Ellipse],[<<IShape>>]^-.-[<<IRoundShape>>],[<<IRoundShape>>]^-.-[Ellipse]", yuml);
        }
Ejemplo n.º 29
0
        public void Interface_Inheritance_FALSE()
        {
            var types = new List<Type> { typeof(Swallow), typeof(IAnimalPrey) };

            // first way is inline
            var yuml = new YumlGenerator(types).UseInterfaceInheritance(false).Yuml();
            Check("[<<IAnimalPrey>>;Swallow]", yuml);
        }
Ejemplo n.º 30
0
 public void Does_Not_Duplicate_Base_Classes()
 {
     var types = new List<Type> { typeof(Animal), typeof(Bird), typeof(Eagle), typeof(Swallow) };
     var yuml = new YumlGenerator(types).Yuml();
     Check("[Animal],[Bird],[Animal]^-[Bird],[Eagle],[Bird]^-[Eagle],[Swallow],[Bird]^-[Swallow]", yuml);
 }
Ejemplo n.º 31
0
 public void Field_Is_Interface()
 {
     var types = new List<Type> { typeof(Key), typeof(IShiny) };
     var yuml = new YumlGenerator(types).Yuml();
     Check("[Key],[Key]->[<<IShiny>>]", yuml);
 }
Ejemplo n.º 32
0
 public void Bidirectional_One_To_One_Shows_Double_Ended_Arrow()
 {
     var types = new List<Type> { typeof(Container), typeof(Component) };
     var yuml = new YumlGenerator(types).Yuml();
     Check("[Container]<->[Component]", yuml);
 }
Ejemplo n.º 33
0
        public void Public_And_Private_Fields()
        {
            var types = new List<Type> { typeof(Lock), typeof(Key), typeof(Secret) };
            var yuml = new YumlGenerator(types).Yuml();
            Check("[Lock],[Lock]->[Key],[Key],[Secret]", yuml);

            yuml = new YumlGenerator(types).SearchNonPublicMembers(true).Yuml();
            Check("[Lock],[Lock]->[Key],[Lock]->[Secret],[Key],[Secret]", yuml);
        }
Ejemplo n.º 34
0
 public void Duplicate_Types_Appear_Only_Once()
 {
     var types = new List<Type> { typeof(Animal), typeof(Animal) };
     var yuml = new YumlGenerator(types).Yuml();
     Check("[Animal]", yuml);
 }
Ejemplo n.º 35
0
 public void Current_A_TO_B()
 {
     var types = new List<Type> { typeof(A), typeof(B) };
     var yuml = new YumlGenerator(types).Yuml();
     Check("[A]->[B],[B]->[A],[A],[B]", yuml);
 }