public void ClearOnClearExcept()
        {
            ConcreteDictionary myDictionary = new ConcreteDictionary(30);

            myDictionary.onClearMustThrowException = true;

            try
            {
                myDictionary.Clear();
                Assert.Fail("#A1");
            }
            catch (AssertionException)
            {
                throw;
            }
            catch (Exception ex)
            {
                Assert.AreEqual(typeof(Exception), ex.GetType(), "#A2");
                Assert.IsNull(ex.InnerException, "#A3");
                Assert.IsNotNull(ex.Message, "#A4");
            }

            Assert.IsTrue(myDictionary.onClearFired, "#B1");
            Assert.IsFalse(myDictionary.onClearCompleteFired, "#B2");
            Assert.AreEqual(30, myDictionary.Count, "#B3");
        }
Exemplo n.º 2
0
        public void ClearOnClearCompleteExcept()
        {
            ConcreteDictionary myDictionary = new ConcreteDictionary(30);

            myDictionary.onClearCompleteMustThrowException = true;

            try {
                myDictionary.Clear();
                Assert.Fail("#A1");
            } catch (AssertionException) {
                throw;
            } catch (Exception ex) {
                Assert.AreEqual(typeof(Exception), ex.GetType(), "#A2");
                Assert.IsNull(ex.InnerException, "#A3");
                Assert.IsNotNull(ex.Message, "#A4");
            }

            Assert.IsFalse(myDictionary.onInsertFired, "#B1");
            Assert.IsFalse(myDictionary.onInsertCompleteFired, "#B2");
            Assert.IsFalse(myDictionary.onValidateFired, "#B3");
            Assert.IsFalse(myDictionary.onRemoveFired, "#B4");
            Assert.IsFalse(myDictionary.onRemoveCompleteFired, "#B5");
            Assert.IsTrue(myDictionary.onClearFired, "#B6");
            Assert.IsTrue(myDictionary.onClearCompleteFired, "#B7");
            Assert.IsFalse(myDictionary.onSetFired, "#B8");
            Assert.IsFalse(myDictionary.onSetCompleteFired, "#B9");
            Assert.IsFalse(myDictionary.onGetFired, "#B10");
            Assert.AreEqual(0, myDictionary.Count, "#B11");
        }
Exemplo n.º 3
0
        public void Clear()
        {
            ConcreteDictionary myDictionary = new ConcreteDictionary(30);

            myDictionary.Clear();

            Assert.IsTrue(myDictionary.onClearFired, "#1");
            Assert.IsTrue(myDictionary.onClearCompleteFired, "#2");
            Assert.AreEqual(0, myDictionary.Count, "#3");
        }
Exemplo n.º 4
0
        public void Clear()
        {
            ConcreteDictionary myDictionary = new ConcreteDictionary(30);

            myDictionary.Clear();

            Assert("OnClear must be fired", myDictionary.onClearFired);
            Assert("OnClearComplete must be fired", myDictionary.onClearCompleteFired);
            AssertEquals("Count", 0, myDictionary.Count);
        }
Exemplo n.º 5
0
        public void ClearOnClearCompleteExcept()
        {
            bool exceptionThrown = false;

            ConcreteDictionary myDictionary = new ConcreteDictionary(30);

            myDictionary.onClearCompleteMustThrowException = true;

            try
            {
                myDictionary.Clear();
            }
            catch
            {
                exceptionThrown = true;
            }
            finally
            {
                Assert("Exception must be thrown", exceptionThrown);
                Assert("OnClear must be fired", myDictionary.onClearFired);
                Assert("OnClearComplete must be fired", myDictionary.onClearCompleteFired);
                AssertEquals("Count", 0, myDictionary.Count);
            }
        }
Exemplo n.º 6
0
		public void ClearOnClearCompleteExcept ()
		{
			ConcreteDictionary myDictionary = new ConcreteDictionary (30);
			myDictionary.onClearCompleteMustThrowException = true;

			try {
				myDictionary.Clear();
				Assert.Fail ("#A1");
			} catch (AssertionException) {
				throw;
			} catch (Exception ex) {
				Assert.AreEqual (typeof (Exception), ex.GetType (), "#A2");
				Assert.IsNull (ex.InnerException, "#A3");
				Assert.IsNotNull (ex.Message, "#A4");
			}

			Assert.IsFalse (myDictionary.onInsertFired, "#B1");
			Assert.IsFalse (myDictionary.onInsertCompleteFired, "#B2");
			Assert.IsFalse (myDictionary.onValidateFired, "#B3");
			Assert.IsFalse (myDictionary.onRemoveFired, "#B4");
			Assert.IsFalse (myDictionary.onRemoveCompleteFired, "#B5");
			Assert.IsTrue (myDictionary.onClearFired, "#B6");
			Assert.IsTrue (myDictionary.onClearCompleteFired, "#B7");
			Assert.IsFalse (myDictionary.onSetFired, "#B8");
			Assert.IsFalse (myDictionary.onSetCompleteFired, "#B9");
			Assert.IsFalse (myDictionary.onGetFired, "#B10");
			Assert.AreEqual (0, myDictionary.Count, "#B11");
		}
Exemplo n.º 7
0
		public void ClearOnClearExcept ()
		{
			ConcreteDictionary myDictionary = new ConcreteDictionary (30);
			myDictionary.onClearMustThrowException = true;

			try {
				myDictionary.Clear ();
				Assert.Fail ("#A1");
			} catch (AssertionException) {
				throw;
			} catch (Exception ex) {
				Assert.AreEqual (typeof (Exception), ex.GetType (), "#A2");
				Assert.IsNull (ex.InnerException, "#A3");
				Assert.IsNotNull (ex.Message, "#A4");
			}

			Assert.IsTrue (myDictionary.onClearFired, "#B1");
			Assert.IsFalse (myDictionary.onClearCompleteFired, "#B2");
			Assert.AreEqual (30, myDictionary.Count, "#B3");
		}
Exemplo n.º 8
0
		public void Clear ()
		{
			ConcreteDictionary myDictionary = new ConcreteDictionary (30);
			myDictionary.Clear();

			Assert.IsTrue (myDictionary.onClearFired, "#1");
			Assert.IsTrue (myDictionary.onClearCompleteFired, "#2");
			Assert.AreEqual (0, myDictionary.Count, "#3");
		}
		public void ClearOnClearCompleteExcept() 
		{
			bool exceptionThrown = false;

			ConcreteDictionary myDictionary = new ConcreteDictionary(30);
			myDictionary.onClearCompleteMustThrowException = true;

			try {
				myDictionary.Clear();
			} catch {
				exceptionThrown = true;
			} finally {
				Assert("Exception must be thrown", exceptionThrown);
				Assert("OnClear must be fired", myDictionary.onClearFired);
				Assert("OnClearComplete must be fired", myDictionary.onClearCompleteFired);
				AssertEquals("Count", 0, myDictionary.Count);
			}

		}
		public void Clear() 
		{
			ConcreteDictionary myDictionary = new ConcreteDictionary(30);
			myDictionary.Clear();

			Assert("OnClear must be fired", myDictionary.onClearFired);
			Assert("OnClearComplete must be fired", myDictionary.onClearCompleteFired);
			AssertEquals("Count", 0, myDictionary.Count);
		}