예제 #1
0
        public void Add_One_Entry()
        {
            var search = new SequentialSearchSt <int, string>();

            search.Add(1, "val1");
            Assert.That(search.Count, Is.EqualTo(1));
        }
예제 #2
0
        public void Add_Multiple_Entries()
        {
            var search  = new SequentialSearchSt <int, string>();
            var entries = 5;

            for (int i = 0; i < 5; i++)
            {
                search.Add(i, $"val{i}");
            }
            Assert.That(search.Count, Is.EqualTo(entries));
        }
예제 #3
0
        public void Remove_Entry_Key_Is_Invalid()
        {
            // Arrange
            var search = new SequentialSearchSt <int, string>();

            for (int i = 0; i < 5; i++)
            {
                search.Add(i, $"val{i}");
            }

            // Act
            // Assert
            Assert.That(search.Remove(300), Is.False);
        }
예제 #4
0
        public void Get_Added_Entry()
        {
            // Arrange
            var search = new SequentialSearchSt <int, string>();

            for (int i = 0; i < 5; i++)
            {
                search.Add(i, $"val{i}");
            }

            // Act
            Assert.That(search.TryGet(3, out var value), Is.True);

            // Assert
            Assert.That(value, Is.EqualTo("val3"));
        }