public void Pop_Ok() { var obj = new BootstrapContext(viewContext, null, null, null); var obj1 = new Class1(); var obj2 = new Class2(); var obj3 = new Class1(); obj.Push(obj1); obj.Push(obj2); obj.Push(obj3); // this throws error try { obj.PopIfEqual(obj2); Assert.True(false, "Should not got there :("); } catch (ArgumentException) { // It,s Ok } // obj3 is still at last positon obj.PopIfEqual(obj3); // and now can POP obj2 obj.PopIfEqual(obj2); // and obj1 is last one obj.PopIfEqual(obj1); // nothing more Assert.Null(obj.PeekNearest <object>()); }
public void PeekNearest_Ok() { var obj = new BootstrapContext(viewContext, null, null, null); var obj1 = new Class1(); var obj2 = new Class2(); var obj3 = new Class1(); obj.Push(obj1); obj.Push(obj2); obj.Push(obj3); Assert.Same(obj2, obj.PeekNearest <Class2>()); }
public void PeekNearest_Ok() { var obj = new BootstrapContext(viewContext, null, null, null); var obj1 = new Class1(); var obj2 = new Class2(); var obj3 = new Class1(); obj.Push(obj1); obj.Push(obj2); obj.Push(obj3); Assert.Same(obj2, obj.PeekNearest<Class2>()); }
public void Pop_Ok() { var obj = new BootstrapContext(viewContext, null, null, null); var obj1 = new Class1(); var obj2 = new Class2(); var obj3 = new Class1(); obj.Push(obj1); obj.Push(obj2); obj.Push(obj3); // this throws error try { obj.PopIfEqual(obj2); Assert.True(false, "Should not got there :("); } catch (ArgumentException) { // It,s Ok } // obj3 is still at last positon obj.PopIfEqual(obj3); // and now can POP obj2 obj.PopIfEqual(obj2); // and obj1 is last one obj.PopIfEqual(obj1); // nothing more Assert.Null(obj.PeekNearest<object>()); }