Example #1
0
        public void GroupsAreSorted()
        {
            var list = new ListItemCollection <string>();

            list.AddGroup("Bob", new List <string>
            {
                "Foo",
                "Bar"
            });

            list.AddGroup("Dave", new List <string>
            {
                "Hello",
                "World"
            });

            list.Should().HaveCount(2);
            list[0].Title.Should().Be("Bob");
            list[1].Title.Should().Be("Dave");

            list.TitleSortOrder = new List <string>
            {
                "Dave",
                "Colin",
                "Bob"
            };

            list.Should().HaveCount(2);
            list[0].Title.Should().Be("Dave");
            list[1].Title.Should().Be("Bob");

            list.AddGroup("Colin", new List <string>
            {
                "FooBar",
                "HelloWorld"
            });

            list.Should().HaveCount(3);
            list[0].Title.Should().Be("Dave");
            list[1].Title.Should().Be("Colin");
            list[2].Title.Should().Be("Bob");

            list.Delete("FooBar");
            list.Delete("HelloWorld");

            list.Should().HaveCount(2);
            list[0].Title.Should().Be("Dave");
            list[1].Title.Should().Be("Bob");
        }
Example #2
0
        public void DeleteReturnsTrueIfItDeletesTheItem()
        {
            var list = new ListItemCollection <string>();

            list.AddGroup("Hello", new List <string> {
                "Foo", "Bar"
            });
            list.Delete("Foo").Should().BeTrue();
        }
Example #3
0
        public void DeleteDeletesItem()
        {
            var list = new ListItemCollection <string>();

            list.AddGroup("Hello", new List <string> {
                "Foo", "Bar"
            });
            list.Delete("Foo");

            list.Should().HaveCount(1);
            list.Should().Contain(g => g.Title == "Hello" && g.Count == 1 && g[0] == "Bar");
        }
Example #4
0
        public void DeleteReturnsFalseIfTheItemDoesnExist()
        {
            var list = new ListItemCollection <string>();

            list.AddGroup("Hello", new List <string> {
                "Foo", "Bar"
            });
            list.Delete("World").Should().BeFalse();

            list.Should().HaveCount(1);
            list.Should().Contain(g => g.Title == "Hello" && g.Count == 2 &&
                                  g.Contains("Foo") && g.Contains("Bar"));
        }
Example #5
0
        public void DeleteRemovesEmptyGroups()
        {
            var list = new ListItemCollection <string>();

            list.AddGroup("Hello", new List <string> {
                "Foo", "Bar"
            });
            list.AddGroup("World", new List <string> {
                "FooBar"
            });

            list.Should().HaveCount(2);

            list.Delete("FooBar").Should().BeTrue();

            list.Should().HaveCount(1);
            list.Should().Contain(g => g.Title == "Hello" && g.Count == 2 &&
                                  g.Contains("Foo") && g.Contains("Bar"));
        }
        public void GroupsAreSorted()
        {
            var list = new ListItemCollection<string>();

            list.AddGroup("Bob", new List<string>
            {
                "Foo",
                "Bar"
            });

            list.AddGroup("Dave", new List<string>
            {
                "Hello",
                "World"
            });

            list.Should().HaveCount(2);
            list[0].Title.Should().Be("Bob");
            list[1].Title.Should().Be("Dave");

            list.TitleSortOrder = new List<string>
            {
                "Dave",
                "Colin",
                "Bob"
            };

            list.Should().HaveCount(2);
            list[0].Title.Should().Be("Dave");
            list[1].Title.Should().Be("Bob");

            list.AddGroup("Colin", new List<string>
            {
                "FooBar",
                "HelloWorld"
            });

            list.Should().HaveCount(3);
            list[0].Title.Should().Be("Dave");
            list[1].Title.Should().Be("Colin");
            list[2].Title.Should().Be("Bob");

            list.Delete("FooBar");
            list.Delete("HelloWorld");

            list.Should().HaveCount(2);
            list[0].Title.Should().Be("Dave");
            list[1].Title.Should().Be("Bob");
        }
 public void DeleteReturnsTrueIfItDeletesTheItem()
 {
     var list = new ListItemCollection<string>();
     list.AddGroup("Hello", new List<string> { "Foo", "Bar" });
     list.Delete("Foo").Should().BeTrue();
 }
        public void DeleteReturnsFalseIfTheItemDoesnExist()
        {
            var list = new ListItemCollection<string>();
            list.AddGroup("Hello", new List<string> { "Foo", "Bar" });
            list.Delete("World").Should().BeFalse();

            list.Should().HaveCount(1);
            list.Should().Contain(g => g.Title == "Hello" && g.Count == 2 &&
                g.Contains("Foo") && g.Contains("Bar"));
        }
        public void DeleteRemovesEmptyGroups()
        {
            var list = new ListItemCollection<string>();
            list.AddGroup("Hello", new List<string> { "Foo", "Bar" });
            list.AddGroup("World", new List<string> { "FooBar" });

            list.Should().HaveCount(2);

            list.Delete("FooBar").Should().BeTrue();

            list.Should().HaveCount(1);
            list.Should().Contain(g => g.Title == "Hello" && g.Count == 2 &&
                g.Contains("Foo") && g.Contains("Bar"));
        }
        public void DeleteDeletesItem()
        {
            var list = new ListItemCollection<string>();
            list.AddGroup("Hello", new List<string> { "Foo", "Bar" });
            list.Delete("Foo");

            list.Should().HaveCount(1);
            list.Should().Contain(g => g.Title == "Hello" && g.Count == 1 && g[0] == "Bar");
        }