Пример #1
0
        public void Contains_OnNonExistingElement_ShouldReturnFalse()
        {
            dynamicList.Add(1);
            var contains = dynamicList.Contains(2);

            Assert.IsFalse(contains);
        }
Пример #2
0
        public void RemoveAtIndexMethodShouldRemoveTheCorrectItem()
        {
            int removedItem = intList.RemoveAt(3);

            Assert.AreEqual(8, removedItem);
            Assert.AreEqual(4, intList.Count);
            Assert.That(!intList.Contains(8));
        }
Пример #3
0
        public void ContainsExistingElementShouldReturnTrue()
        {
            list.Add(5);

            var contains = list.Contains(5);

            Assert.IsTrue(contains, "Contains() returned False!");
        }
Пример #4
0
        public void TestContainsExistingElement()
        {
            dynamicList.Add(3);
            dynamicList.Add(5);
            dynamicList.Add(8);
            bool contains = dynamicList.Contains(5);

            Assert.IsTrue(contains);
        }
        public void IfTheListContainsElementItShouldReturnItCorrectly()
        {
            linkedList.Add(5);
            linkedList.Add(10);
            linkedList.Add(20);
            linkedList.Add(2);

            Assert.IsTrue(linkedList.Contains(10));
        }
Пример #6
0
        public void TestIfDynamicListContainsElement()
        {
            dynamicList.Add(10);
            dynamicList.Add(5);
            dynamicList.Add(3);

            bool elementExists = dynamicList.Contains(10);

            Assert.IsTrue(elementExists);
        }
        public void Contains_ExistingItem_ShouldReturnTrue()
        {
            int item = 5;

            list.Add(item);

            bool actual   = list.Contains(item);
            bool expected = true;

            Assert.AreEqual(actual, expected);
        }
        public void ContainsMethodShouldReturnTrueIfElementIsPresent()
        {
            dynamicList.Add(11);
            dynamicList.Add(22);
            dynamicList.Add(33);

            var expected = true;
            var actual   = dynamicList.Contains(22);

            Assert.That(expected, Is.EqualTo(expected));
        }
        public void TestLinkList_Contains_ToReturnTrue(int value)
        {
            dl.Add(1);
            dl.Add(2);
            dl.Add(3);
            dl.Add(-5);
            dl.Add(-10);
            var actual   = dl.Contains(value);
            var expected = true;

            Assert.That(actual, Is.EqualTo(expected));
        }
Пример #10
0
        public void TestValidContains()
        {
            var valueToFind = 15;

            dl.Add(10);
            dl.Add(valueToFind);
            dl.Add(20);

            var expectedValue = true;
            var actualValue   = dl.Contains(valueToFind);

            Assert.That(actualValue, Is.EqualTo(expectedValue));
        }
Пример #11
0
        public void AddContainsAndIndexOfTest()
        {
            DynamicList<string> words = new DynamicList<string>();
            words.Add("Pesho");
            words.Add("Strahil");
            Assert.AreEqual(2, words.Count, "Error in the adding command.");

            Assert.IsFalse(words.Contains("Ivan"), "Contains method works incorectly.");
            Assert.IsTrue(words.Contains("Pesho"), "Error in adding or contains.");

            Assert.AreEqual(-1, words.IndexOf("Ivan"), "Error in indexOf method.");
            Assert.AreNotEqual(-1, words.IndexOf("Strahil"), "Error in indexOf method.");
        }
Пример #12
0
        public void AddContainsAndIndexOfTest()
        {
            DynamicList <string> words = new DynamicList <string>();

            words.Add("Pesho");
            words.Add("Strahil");
            Assert.AreEqual(2, words.Count, "Error in the adding command.");

            Assert.IsFalse(words.Contains("Ivan"), "Contains method works incorectly.");
            Assert.IsTrue(words.Contains("Pesho"), "Error in adding or contains.");

            Assert.AreEqual(-1, words.IndexOf("Ivan"), "Error in indexOf method.");
            Assert.AreNotEqual(-1, words.IndexOf("Strahil"), "Error in indexOf method.");
        }
        public void Contains_ToAlreadyInitializedList_ShouldReturnTrueOrFalse()
        {
            var list = new DynamicList<long>();
            list.Add(123870814435);
            list.Add(-3275475243432);
            list.Add(9864354472332);
            list.Add(4574552354354756756);
            list.Add(92385023497544325);

            var firstNum = list.Contains(4);
            var secondNum = list.Contains(9864354472332);

            Assert.IsFalse(firstNum);
            Assert.IsTrue(secondNum);
        }
 public void TestContains_NExistingElement_ShouldReturnPositive()
 {
     var list = new DynamicList<int>();
     list.Add(5);
     var isContains = list.Contains(5);
     Assert.IsTrue(isContains);
 }
Пример #15
0
        public void Contains_OneElementInDynamicListButItSearchesForAnotherOne_ShouldReturnFalse()
        {
            dynamicIntList.Add(IntegerTestValue);
            bool containsOtherValue = dynamicIntList.Contains(IntegerTestValue2);

            Assert.AreEqual(false, containsOtherValue, "Contains method should return false if the element we check is not present in the dynamic list");
        }
Пример #16
0
        public void TestIfListContainsExistingElement()
        {
            var dynamListTest = new DynamicList <int>();

            dynamListTest.Add(2);
            Assert.IsTrue(dynamListTest.Contains(2));
        }
Пример #17
0
 public void TestContainsMethod()
 {
     list = new DynamicList <int>();
     list.Add(2);
     list.Add(3);
     Assert.AreEqual(list.Contains(3), true);
 }
Пример #18
0
        public void Contains_OneElementInDynamicList_ShouldReturnTrue()
        {
            dynamicStringList.Add("Pesho");
            bool containsValue = dynamicStringList.Contains("Pesho");

            Assert.AreEqual(true, containsValue, "Contains method should return true if the element we check is present in the dynamic list");
        }
Пример #19
0
        public void Contains_NullElementInExistingList_ShouldThrowExcepion()
        {
            var stringList = new DynamicList <string>();

            stringList.Add("Pesho");
            stringList.Contains(null);
        }
Пример #20
0
        public void ListElementsCheckingElementNotInTheListShoudNotContainElement()
        {
            var list = new DynamicList<int>();
            list.Add(1);
            list.Add(2);

            Assert.IsFalse(list.Contains(6), "The list must not contain 6.");
        }
        public void Contains_GivenElement_ReturnFalse()
        {
            //Arrange
            var list = new DynamicList <string>();

            //Arrange
            Assert.That(list.Contains("Neshto si"), Is.False);
        }
Пример #22
0
        public void ContainsNotPass(int value)
        {
            DynamicList <int> dynamicList = new DynamicList <int>();

            dynamicList.Add(20);
            dynamicList.Add(10);
            Assert.AreEqual(false, dynamicList.Contains(value));
        }
        public void Contains_ToEmptyList_ShouldReturnFalse()
        {
            var list = new DynamicList<double>();

            var doesContain = list.Contains(2.532);

            Assert.IsFalse(doesContain, "Must return false when the list is empty.");
        }
Пример #24
0
    public void ContainsMethodShouldReturnTrueThenGivenItemIsInTheList()
    {
        var dynList = new DynamicList <string>();

        dynList.Add("Test");

        Assert.True(dynList.Contains("Test"));
    }
Пример #25
0
        public void ListElementsCheckingElementNotInTheListShoudNotContainElement()
        {
            var list = new DynamicList <int>();

            list.Add(1);
            list.Add(2);

            Assert.IsFalse(list.Contains(6), "The list must not contain 6.");
        }
Пример #26
0
        public void AddingElementShouldContainElement()
        {
            var list = new DynamicList<int>();
            list.Add(1);
            list.Add(2);
            list.Add(6);

            Assert.IsTrue(list.Contains(6), "The list must contain 6.");
        }
Пример #27
0
 public void TestContainsEmptyList_ShouldReturnFalse()
 {
     // Arrange
     var list = new DynamicList<int>();
     // Act
     bool contains = list.Contains(22);
     // Assert
     Assert.IsFalse(contains);
 }
        public void ContainsMethodShouldReturnTrueIfTheCollectionContainsGivenElement(int element)
        {
            DynamicList <int> coolList = new DynamicList <int>();

            coolList.Add(6);
            coolList.Add(9);

            Assert.That(coolList.Contains(element) == true);
        }
Пример #29
0
        public void Remove_ExistantItem_ShouldRemoveItem()
        {
            list.Add(4);
            list.Add(5);

            list.Remove(5);

            Assert.IsFalse(list.Contains(5));
        }
        public void ContainsMethodShouldReturnFalseIfTheCollectionDoesNotContainGivenElement(int element)
        {
            DynamicList <int> coolList = new DynamicList <int>();

            coolList.Add(6);
            coolList.Add(9);

            Assert.That(coolList.Contains(element) == false);
        }
Пример #31
0
        public void Check_If_Contains_Method_Returns_Correct_Value(int item)
        {
            for (int i = 0; i <= 3; i++)
            {
                list.Add((int)Math.Pow(7, i));
            }

            Assert.IsTrue(list.Contains(item), "Existing element was not found!");
        }
Пример #32
0
        public void Contains_ShouldReturTrue_IfValueExist()
        {
            string itemToAdd          = "element";
            IDynamicList <string> sut = new DynamicList <string>();

            sut.Add(itemToAdd);

            Assert.That(() => sut.Contains(itemToAdd), Is.True);
        }
Пример #33
0
        public void TestContainsElement_SingleElement_TheListContainsTheElement()
        {
            DynamicList <int> customList = new DynamicList <int>();

            customList.Add(50);
            bool containsElement = customList.Contains(50);

            Assert.IsTrue(containsElement, "Contains method failed: It should be true.");
        }
        public void Test_ContainsOnExisingElement()
        {
            var list = new DynamicList<string>();
            list.Add("first");
            list.Add("second");

            var isFound = list.Contains("second");

            Assert.IsTrue(isFound, "The element is in the list and Contains should return true.");
        }
Пример #35
0
        public void Test_DynamicListContain_ShouldReturnTrue()
        {
            DynamicList<string> testList = new DynamicList<string>();
            string item = "dynamic";

            testList.Add(item);
            bool actual = testList.Contains(item);

            Assert.AreEqual(true, actual, "Did not return true when find the item in the list!");
        }
Пример #36
0
        public void TestContainsOnNonExisingElement()
        {
            DynamicList<string> list = new DynamicList<string>();
            list.Add("first");
            list.Add("second");

            bool isFound = list.Contains("third");

            Assert.IsFalse(isFound, "The element is not in the list and Contains should return false.");
        }
        public void Contains_EmptyList_WorksCorrectly()
        {
            DynamicList <int> list = new DynamicList <int>();


            bool expectedResult = false;
            bool actualResult   = list.Contains(15);

            Assert.That(actualResult, Is.EqualTo(expectedResult), "Incorrect value returned.");
        }
Пример #38
0
        public void AddingElementShouldContainElement()
        {
            var list = new DynamicList <int>();

            list.Add(1);
            list.Add(2);
            list.Add(6);

            Assert.IsTrue(list.Contains(6), "The list must contain 6.");
        }
Пример #39
0
        public void ContainsReturnsCorrectValue(int element, bool expected)
        {
            testList.Add(2);
            testList.Add(5);
            testList.Add(4);
            testList.Add(5);
            testList.Add(10);

            Assert.That(testList.Contains(element), Is.EqualTo(expected));
        }
Пример #40
0
        public void Test_DynamicListContain_ShouldReturnFalse()
        {
            DynamicList <string> testList = new DynamicList <string>();
            string item = "dynamic";

            testList.Add(item);
            bool actual = testList.Contains("list");

            Assert.AreEqual(false, actual, "Did not return false when not find the item in the list!");
        }
Пример #41
0
 public void TestContainsFullList_ShouldReturnTrue()
 {
     // Arrange
     var list = new DynamicList<int>();
     list.Add(3);
     list.Add(1);
     // Act
     bool contains = list.Contains(3);
     // Assert
     Assert.IsTrue(contains);
 }
        public void TestContainsWithNonExistingElement()
        {
            DynamicList<int>list=new DynamicList<int>();
            list.Add(1);
            list.Add(2);
            list.Add(3);

            bool result = list.Contains(5);

            Assert.AreEqual(false,result,"If list not contains element should return false");
        }
Пример #43
0
        public void TestContains_ShouldReturnTrueForElementsInTheList()
        {
            // Arrange
            DynamicList<int> testList = new DynamicList<int>();

            // Act
            FillTestListWith10Elements(testList);
            bool test = testList.Contains(5);

            // Assert
            Debug.Assert(test == true, "Checking for existing elements should return true.");
        }
Пример #44
0
        public void ContainsTest()
        {
            DynamicList<int> list = new DynamicList<int>();

            list.Add(1);
            list.Add(2);
            list.Add(3);

            var result = list.Contains(2);

            Assert.IsTrue(result, "List does not search correctly");
        }
Пример #45
0
        public void TestContains_ShouldReturnFalseForElementsNotInTheList()
        {
            // Arrange
            DynamicList<int> testList = new DynamicList<int>();

            // Act
            FillTestListWith10Elements(testList);
            bool test = testList.Contains(51);

            // Assert
            Debug.Assert(test == false, "Checking for non existing elements should return false.");
        }
        public void Contains_CheckForNonExistingElement_ShouldReturnFalse()
        {
            var list = new DynamicList<string>();
            list.Add("Test");
            list.Add("All");
            list.Add("Methods!");

            bool expected = false;
            bool actual = list.Contains("What?");

            Assert.AreEqual(expected, actual);
        }
        public void Contains_CheckForExistingElement_ShouldReturnTrue()
        {
            var list = new DynamicList<char>();
            list.Add('s');
            list.Add('j');
            list.Add('m');

            bool expected = true;
            bool actual = list.Contains('j');

            Assert.AreEqual(expected, actual);
        }
Пример #48
0
        public void ContainsExistingElement_True()
        {
            var dynamicList = new DynamicList<int>();

            const int firstElement = 666;
            const int secondElement = 777;
            dynamicList.Add(firstElement);
            dynamicList.Add(secondElement);

            bool contains = dynamicList.Contains(secondElement);

            Assert.AreEqual(true, contains, "The array should contain the element!");
        }
        public void Test_ContainsInEmptyDynamicList_ShouldReturnMinusOne()
        {
            //Arrange
            var dynamicList = new DynamicList<int>();
            int falseItem = 666;
            //Act
            var returnedContainsMethod = dynamicList.Contains(falseItem);

            //Assert
            Assert.IsNotNull(dynamicList);
            Assert.AreEqual(0, dynamicList.Count, "Size is not the same.");
            Assert.AreEqual(false, returnedContainsMethod, "Did not return -1.");
        }
Пример #50
0
        public void ContainsNonExistingElement_False()
        {
            var dynamicList = new DynamicList<int>();

            const int firstElement = 666;
            const int secondElement = 777;
            const int randomNumber = 123;
            dynamicList.Add(firstElement);
            dynamicList.Add(secondElement);

            bool contains = dynamicList.Contains(randomNumber);

            Assert.AreEqual(false, contains, "The array should not contain the element!");
        }
Пример #51
0
        public void RemoveAndRemoveAtTest()
        {
            DynamicList<int> numbers = new DynamicList<int>();
            numbers.Add(5);
            numbers.Add(7);
            numbers.Add(9);

            numbers.Remove(5);
            Assert.IsFalse(numbers.Contains(5), "Remove method doesn't work correctly.");

            numbers.RemoveAt(1);
            Assert.AreEqual(-1, numbers.IndexOf(9), "RemoveAt method doesn't work correctly.");

            Assert.AreEqual(-1, numbers.Remove(13), "Error when trying to remove unexisting item.");

            Assert.AreEqual(0, numbers.Remove(7), "Wrong return value of remove method.");
        }
        public void Test_ContainsFalseItemInDynamicList_ShouldReturnMinusOne()
        {
            //Arrange
            var dynamicList = new DynamicList<int>();
            int count = 100;
            int falseItem = 666;
            //Act
            for (int i = 0; i < count; i++)
            {
                dynamicList.Add(i);
            }
            var returnedContainsMethod = dynamicList.Contains(falseItem);

            //Assert
            Assert.IsNotNull(dynamicList);
            Assert.AreEqual(count, dynamicList.Count, "Size is not the same.");
            Assert.AreEqual(false, returnedContainsMethod, "Did not return -1.");
        }
        public void TestList_Contain_ShouldReturnFalse()
        {
            DynamicList<string> list = new DynamicList<string>();
            list.Add("first");
            list.Add("second");

            bool isFound = list.Contains("second");

            Assert.IsTrue(isFound, "The element is in the list and Contains should return true.");
        }
Пример #54
0
        public void TestContains()
        {
            var dynamicList = new DynamicList<int>();
            dynamicList.Add(0);
            dynamicList.Add(2);
            dynamicList.Add(4);
            dynamicList.Add(8);

            // Act
            var isFound = dynamicList.Contains(4);

            // Assert
            Assert.IsTrue(isFound, "This elements is not found.");
        }
Пример #55
0
 public void TestIfListContainsUnexistingElement()
 {
     var dynamListTest = new DynamicList<int>();
     Assert.IsFalse(dynamListTest.Contains(10));
 }
Пример #56
0
        public void RemoveTest()
        {
            DynamicList<int> list = new DynamicList<int>();

            list.Add(1);
            list.Add(2);
            list.Add(3);

            list.Remove(3);

            Assert.IsFalse(list.Contains(3), "List does not remove items correctly");
        }
 public void TestContains_NotExistingElement_ShouldReturnNegative()
 {
     var list = new DynamicList<int>();
     var isContains = list.Contains(5);
     Assert.IsFalse(isContains);
 }
Пример #58
0
 public void TestIfListContainsExistingElement()
 {
     var dynamListTest = new DynamicList<int>();
     dynamListTest.Add(2);
     Assert.IsTrue(dynamListTest.Contains(2));
 }
        public void Contains_ShouldReturn_True_WhenItemExists()
        {
            var dynamicList = new DynamicList<int>();
            dynamicList.Add(5);
            dynamicList.Add(6);
            dynamicList.Add(12);

            var doesContain = dynamicList.Contains(6);
            Assert.AreEqual(true, doesContain, "The method .Contains isn't working correctly.");
        }
Пример #60
0
        public void FoundingElementInListShouldNotFoundIt()
        {
            var numbers = new DynamicList<int>();

            numbers.Add(10);
            numbers.Add(12);
            numbers.Add(-14);

            var initialCount = numbers.Count;
            var index = numbers.Remove(12);

            Assert.IsFalse(numbers.Contains(12), "The element is not removed.");
            Assert.IsTrue(numbers.Count < initialCount, "The count does not decrease.");
            Assert.AreEqual(1, index, "Return invalid index.");
        }