예제 #1
0
        public void Stack_Contains_ContainsMustWork(IStack<int> stack)
        {
            const int numberIsNotFromMass = 703;

            foreach (var elememt in MassOfNumber)
                stack.Push(elememt);

            var actual = stack.Contains(MassOfNumber[0]);
            Assert.Equal(true, actual);

            actual = stack.Contains(numberIsNotFromMass);
            Assert.Equal(false, actual);
        }
예제 #2
0
        public void Stack_Contains_ContainsMustWork(IStack <int> stack)
        {
            const int numberIsNotFromMass = 703;

            foreach (var elememt in MassOfNumber)
            {
                stack.Push(elememt);
            }

            var actual = stack.Contains(MassOfNumber[0]);

            Assert.AreEqual(true, actual);

            actual = stack.Contains(numberIsNotFromMass);
            Assert.AreEqual(false, actual);
        }
예제 #3
0
 public bool Contains(T value)
 {
     lock (SyncRoot)
     {
         return(stack.Contains(value));
     }
 }
예제 #4
0
        public bool Contains(int elt)
        {
            Chess.ObserveOperationCall(impl, "Contains");
            Chess.ObserveInteger("elt", elt);
            bool retval = impl.Contains(elt);

            Chess.ObserveBoolean("retval", retval);
            Chess.ObserveOperationReturn();
            return(retval);
        }
예제 #5
0
        public bool Contains(T elt)
        {
            Chess.ObserveOperationCall(impl, "Contains");
            Chess.ObserveObjectIdentity("elt", elt);
            bool retval = impl.Contains(elt);

            Chess.ObserveBoolean("retval", retval);
            Chess.ObserveOperationReturn();
            return(retval);
        }
예제 #6
0
 void CheckValue(int value, IStack stack)
 {
     if (stack.Contains(value))
     {
         Console.WriteLine("The stack contains " + value);
     }
     else
     {
         Console.WriteLine("The stack doesn't contain " + value);
     }
 }
예제 #7
0
 bool CheckValues(int nr, IStack stack)
 {
     if (stack.Contains(nr))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
예제 #8
0
 // For testing contains method.
 void CheckValues(IStack ArrayStack, int value)
 {
     if (ArrayStack.Contains(value))
     {
         Console.ForegroundColor = ConsoleColor.Green;
         Console.WriteLine("\n{0} is present in the stack!!", value);
     }
     else
     {
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine("\nOops, {0} is not present in the stack", value);
     }
     Console.ResetColor();
 }
예제 #9
0
        void CheckValues(IStack stack)
        {
            int value = 0;

            while (value != -1)
            {
                value = ReadTools.ReadInt("Search for a value (stop = -1): ", -1, 100);
                if (value != -1)
                {
                    if (stack.Contains(value))
                    {
                        Console.WriteLine($"The stack does contain {value}.");
                    }
                    else
                    {
                        Console.WriteLine($"The stack does not contain {value}.");
                    }
                }
            }
        }
예제 #10
0
 public bool Contains(T value)
 {
     return(stack.Contains(value));
 }
예제 #11
0
 /// <summary>
 ///     Checks whether or not a certain item is in the stack.
 /// </summary>
 /// <param name="item">The item to check for.</param>
 /// <returns><see langword="true" /> if the item was found, <see langword="false" /> otherwise.</returns>
 public bool Contains(T item) => internalStack.Contains(item);