Beispiel #1
0
        public void TestSort()
        {
            var collection = new NamedCollection <TestElement> {
                new TestElement {
                    Name = "c"
                }, new TestElement {
                    Name = "b"
                }, new TestElement {
                    Name = "a"
                }
            };

            collection.Select(x => x.Name).Should().Equal("a", "b", "c");
        }
Beispiel #2
0
        public void TestRename()
        {
            var element = new TestElement {
                Name = "Name1"
            };

            var collection = new NamedCollection <TestElement> {
                element
            };

            collection["Name1"].Should().BeSameAs(element);

            collection.Rename(element, "Name2");
            element.Name.Should().Be("Name2");
            collection["Name2"].Should().BeSameAs(element);
        }