Beispiel #1
0
        public void CategoryAndNamedObjectAreUnique()
        {
            CategoryCollection categoryCollection = new CategoryCollection();

            categoryCollection.Add("Kursy", new NamedObject("Python"))
            .Add("Kursy", new NamedObject("Python"))
            .Add("Kursy", new NamedObject("Python"));

            categoryCollection.Add("Audiobooki", new NamedObject("HTML"))
            .Add("Audiobooki", new NamedObject("CSS"))
            .Add("Audiobooki", new NamedObject("HTML"))
            .Add("Audiobooki", new NamedObject("HTML"));

            var firstElement  = categoryCollection.ElementAt(0);
            var secondElement = categoryCollection.ElementAt(1);

            Assert.AreEqual(2, categoryCollection.Count);
            Assert.AreEqual(2, firstElement.Value.Count);
            Assert.AreEqual(1, secondElement.Value.Count);
        }
Beispiel #2
0
        public void CategoryAndNamedObjectAreSorted()
        {
            CategoryCollection categoryCollection = new CategoryCollection();

            categoryCollection.AddRange("Kursy", new NamedObject("Python"),
                                        new NamedObject("C#"),
                                        new NamedObject("Java"))

            .AddRange("Audiobooki", new NamedObject("HTML"),
                      new NamedObject("CSS"),
                      new NamedObject("JavaScript"),
                      new NamedObject("Angular"));

            var firstElement  = categoryCollection.ElementAt(0);
            var secondElement = categoryCollection.ElementAt(1);

            Assert.AreEqual("Audiobooki", firstElement.Key);
            Assert.AreEqual("HTML", firstElement.Value.ElementAt(2).Name);
            Assert.AreEqual("Java", secondElement.Value.ElementAt(1).Name);
        }