示例#1
0
        public void Base_Classs_Will_Be_Rendered_By_Default()
        {
            var simulation = new ClassDiagramSimulation(new SimpleDiagram());

            simulation.Simulate();

            Assert.That(simulation.Classes.Count, Is.EqualTo(4));
        }
示例#2
0
        public void TestPersonHasHands()
        {
            var simulation = new ClassDiagramSimulation(new SimpleHasManyDiagram());
            simulation.Simulate();

            Assert.That(simulation.Classes.Count, Is.EqualTo(2));
            Assert.That(simulation.Classes[0].Name, Is.EqualTo("Person"));
            Assert.That(simulation.Classes[1].Name, Is.EqualTo("Hand"));
        }
示例#3
0
        public void GIVEN_A_Simple_Single_Entity_Diagram_WHEN_Rendered_With_Hidden_Fields_THEN_Diagram_Has_One_Class_With_Members_Selectively_Hidden()
        {
            var simulation = new ClassDiagramSimulation(new HiddenFieldBarDiagram());
            simulation.Simulate();

            Assert.That(simulation.Classes.Count, Is.EqualTo(1));
            Assert.That(simulation.Classes[0].Name, Is.EqualTo("SimpleEntity"));
            Assert.That(simulation.Classes[0].Members.Count, Is.EqualTo(3));
            Assert.That(simulation.Classes[0].Members[0].Key, Is.EqualTo("Foo"));
            Assert.That(simulation.Classes[0].Members[1].Key, Is.EqualTo("Bar"));
            Assert.That(simulation.Classes[0].Members[2].Key, Is.EqualTo("Baz"));
        }
示例#4
0
        public void GIVEN_A_Simple_Single_Entity_Diagram_WHEN_Rendered_With_Defaults_THEN_Diagram_Has_One_Class_With_Members()
        {
            var simulation = new ClassDiagramSimulation(new ClassDiagram(typeof(SimpleEntity)));
            simulation.Simulate();

            Assert.That(simulation.Classes.Count, Is.EqualTo(1));
            Assert.That(simulation.Classes[0].Name, Is.EqualTo("SimpleEntity"));
            Assert.That(simulation.Classes[0].Members.Count, Is.EqualTo(3));
            Assert.That(simulation.Classes[0].Members[0].Key, Is.EqualTo("Foo"));
            Assert.That(simulation.Classes[0].Members[1].Key, Is.EqualTo("Bar"));
            Assert.That(simulation.Classes[0].Members[2].Key, Is.EqualTo("Baz"));
        }
示例#5
0
        public void Circular_References_Dont_Create_Multiple_Classes()
        {
            var simulation = new ClassDiagramSimulation(new ClassDiagram(typeof(Foo)));
            simulation.Simulate();

            Assert.That(simulation.Classes.Count, Is.EqualTo(3));
            Assert.That(simulation.Classes["Foo"].Members["SomeString"].MemberType, Is.EqualTo(typeof(string)));
            Assert.That(simulation.Classes["Foo"].Members["TheBar"].MemberType, Is.EqualTo(typeof(Bar)));

            Assert.That(simulation.Classes["Bar"].Members["SomeDate"].MemberType, Is.EqualTo(typeof(DateTime?)));

            Assert.That(simulation.Classes["Baz"].Members["TheFoo"].MemberType, Is.EqualTo(typeof(Foo)));
        }
示例#6
0
        public void Circular_References_Dont_Create_Multiple_Classes()
        {
            var simulation = new ClassDiagramSimulation(new Diagram());
            simulation.Simulate();

            Assert.That(simulation.Classes.Count, Is.EqualTo(3));
            Assert.That(simulation.Interfaces.Count, Is.EqualTo(1));
            Assert.That(simulation.Interfaces["IDisposable"], Is.Not.Null);

            Assert.That(simulation.Classes["Foo"].Members["SomeString"].MemberType, Is.EqualTo(typeof(string)));
            Assert.That(simulation.Classes["Foo"].Members["TheBar"].MemberType, Is.EqualTo(typeof(Bar)));
            Assert.That(simulation.Classes["Foo"].Extensions["IDisposable"].AsInterface(), Is.True);

            Assert.That(simulation.Classes["Bar"].Members["SomeDate"].MemberType, Is.EqualTo(typeof(DateTime?)));

            Assert.That(simulation.Classes["Baz"].Members["TheFoo"].MemberType, Is.EqualTo(typeof(Foo)));
        }