Ejemplo n.º 1
0
        public void IncludeWorksWithMultipleItems()
        {
            // --- Arrange
            var si = new SourceFileItem("myitem.z80asm");

            // --- Act
            var child1 = new SourceFileItem("mychild1");

            si.Include(child1);
            var child2 = new SourceFileItem("mychild2");

            si.Include(child2);

            // --- Assert
            si.Parent.ShouldBeNull();
            si.Includes.Count.ShouldBe(2);
            si.Includes.ShouldContain(child1);
            child1.Parent.ShouldBe(si);
            si.Includes.ShouldContain(child2);
            child2.Parent.ShouldBe(si);
        }
Ejemplo n.º 2
0
        public void IncludeDoesNotAddRepeatedItem()
        {
            // --- Arrange
            var si = new SourceFileItem("myitem.z80asm");

            // --- Act
            var child1  = new SourceFileItem("mychild");
            var result1 = si.Include(child1);
            var child2  = new SourceFileItem("mychild");
            var result2 = si.Include(child2);

            // --- Assert
            result1.ShouldBeTrue();
            result2.ShouldBeFalse();
            si.Parent.ShouldBeNull();
            si.Includes.Count.ShouldBe(1);
            si.Includes.ShouldContain(child1);
            child1.Parent.ShouldBe(si);
            si.Includes.ShouldNotContain(child2);
            child2.Parent.ShouldBeNull();
        }
Ejemplo n.º 3
0
        public void IncludeWorksWithSingleItem()
        {
            // --- Arrange
            var si = new SourceFileItem("myitem.z80asm");

            // --- Act
            var child = new SourceFileItem("mychild");

            si.Include(child);

            // --- Assert
            si.ShouldNotBeNull();
            si.Filename.ShouldBe("myitem.z80asm");
            si.Parent.ShouldBeNull();
            si.Includes.Count.ShouldBe(1);
            si.Includes.ShouldContain(child);
            child.Parent.ShouldBe(si);
        }