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); }
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); }
public bool Contains(T value) { lock (SyncRoot) { return(stack.Contains(value)); } }
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); }
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); }
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); } }
bool CheckValues(int nr, IStack stack) { if (stack.Contains(nr)) { return(true); } else { return(false); } }
// 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(); }
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}."); } } } }
public bool Contains(T value) { return(stack.Contains(value)); }
/// <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);