public void TestJoinWithNull()
        {
            var input = new List <string> {
                "Rosen", "Georgi", "Balkan"
            };

            names.AddAll(input);
            names.JoinWith(null);
        }
        public void TestAddingAllFromCollectionIncreasesSize()
        {
            List <string> stringList = new List <string>()
            {
                "Pesho", "Gosho"
            };

            names.AddAll(stringList);
            Assert.AreEqual(2, names.Size);
        }
示例#3
0
        public void TestAddingAllFromCollectionIncreasesSize()
        {
            var newNames = new List <string>();

            newNames.Add("a");
            newNames.Add("b");

            names.AddAll(newNames);

            Assert.AreEqual(names.Size, 2);
        }
示例#4
0
        public void TestAddingAllFromCollectionIncreasesSize()
        {
            string[] testCollection = new string[3] {
                "Stamat", "Stavri", "Kenov"
            };
            expectedSize = testCollection.Length;

            names.AddAll(testCollection);

            Assert.AreEqual(expectedSize, this.names.Size);
        }
        public void AddingAllFromCollectionIncreasesSize()
        {
            //Arrange
            var list = new List <string> {
                "Test1", "Test2"
            };

            //Act
            names.AddAll(list);

            //Assert
            Assert.AreEqual(2, names.Size);
        }
 public void TestAddingAllFromCollection_IncreasesSize()
 {
     this.names = new SimpleSortedList <string>();
     string[] input = new string[] { "asdf", "qwerty", "uhaaa", "yup" };
     names.AddAll(input);
     Assert.That(this.names.Size, Is.EqualTo(input.Length));
 }
        public void TestJoinWithNull()
        {
            this.names = new SimpleSortedList <string>();
            string[] input = new string[] { "aaaaa", "cccc", "BBBB", "dd", "eeee" };

            names.AddAll(input);

            Assert.That(() => names.JoinWith(null), Throws.ArgumentNullException);
        }
        public void TestJoinWorksFine(string separator)
        {
            this.names = new SimpleSortedList <string>();
            string[] input = new string[] { "aaaaa", "cccc", "BBBB", "dd", "eeee" };

            names.AddAll(input);
            string result = names.JoinWith(separator);

            Assert.That(result, Is.EqualTo(string.Join(separator, input.OrderBy(n => n))));
        }
        public void TestAddAllKeepsSorted()
        {
            this.names = new SimpleSortedList <string>();
            string[] input = new string[] { "qwerty", "yup", "Uhaaa", "Baba", "asdf" };
            names.AddAll(input);
            FieldInfo namesType = names.GetType().GetField("innerCollection", BindingFlags.NonPublic | BindingFlags.Instance);

            string[] resultCollection   = ((string[])namesType.GetValue(names)).Take(input.Length).ToArray();
            string[] expectedCollection = new string[] { "asdf", "Baba", "qwerty", "Uhaaa", "yup" };
            Assert.That(resultCollection, Is.EquivalentTo(expectedCollection));
        }
示例#10
0
        public void TestAddAllKeepsSorted()
        {
            string[]      expectedNamesCollection = new string[] { "Balkan", "Georgi", "Rosen" };
            List <string> namesToBeSorted         = new List <string>();

            namesToBeSorted.Add("Rosen");
            namesToBeSorted.Add("Georgi");
            namesToBeSorted.Add("Balkan");
            this.names = new SimpleSortedList <string>(StringComparer.OrdinalIgnoreCase);
            names.AddAll(namesToBeSorted);
            Assert.AreEqual(expectedNamesCollection[0], names.ToArray()[0]);
            Assert.AreEqual(expectedNamesCollection[1], names.ToArray()[1]);
            Assert.AreEqual(expectedNamesCollection[2], names.ToArray()[2]);
        }
示例#11
0
        public void TestRemoveValidElement_RemovesSelectedOne(string itemToRemove)
        {
            this.names = new SimpleSortedList <string>();
            string[] input = new string[] { "qwerty", "yup", "Uhaaa", "Baba", "asdf" };

            names.AddAll(input);
            bool result = names.Remove(itemToRemove);

            FieldInfo namesType = names.GetType().GetField("innerCollection", BindingFlags.NonPublic | BindingFlags.Instance);

            Assert.That(namesType.GetValue(names), Has.No.Member(itemToRemove));
            Assert.That(this.names.Size, Is.EqualTo(input.Length - 1));
            Assert.That(result == true);
        }
示例#12
0
 public void TestAddingAllFromNullThrowsException()
 {
     this.names = new SimpleSortedList <string>();
     Assert.Throws <ArgumentNullException>(() => names.AddAll(null));
 }
示例#13
0
 public void TestAddingAllFromCollectionIncreasesSize()
 {
     this.names = new SimpleSortedList <string>();
     names.AddAll(new[] { "Georgi", "Rosen" });
     Assert.That(names.Size, Is.EqualTo(2));
 }