public void FlashDiscard() { Flash flash = new Flash(); flash.Add("test1", "hello"); flash.Add("test2", "hello"); flash.Discard("test2"); flash.Sweep(); Assert.IsTrue(flash.ContainsKey("test1")); Assert.IsFalse(flash.ContainsKey("test2")); flash = new Flash(flash); flash.Sweep(); Assert.IsTrue(flash.Count == 0); flash.Add("test1", "hello"); flash.Add("test2", "hello"); flash.Discard(); flash = new Flash(flash); flash.Sweep(); Assert.IsFalse(flash.ContainsKey("test1")); Assert.IsFalse(flash.ContainsKey("test2")); }
public void FlashDiscard() { var flash = new Flash { { "test1", "hello" }, { "test2", "hello" } }; flash.Discard("test2"); flash.Sweep(); Assert.IsTrue(flash.ContainsKey("test1")); Assert.IsFalse(flash.ContainsKey("test2")); flash = new Flash(flash); flash.Sweep(); Assert.IsTrue(flash.Count == 0); flash.Add("test1", "hello"); flash.Add("test2", "hello"); flash.Discard(); flash = new Flash(flash); flash.Sweep(); Assert.IsFalse(flash.ContainsKey("test1")); Assert.IsFalse(flash.ContainsKey("test2")); flash = new Flash { { "test1", "hello" }, { "test1", "hello update" } }; Assert.AreEqual("hello update", flash["test1"]); flash.Discard("test1"); flash.Sweep(); Assert.IsFalse(flash.ContainsKey("test1")); }
public void WhenUsingDiscard_ItemsIsNotKept() { var flash = new Flash { { "test1", "hello" }, { "test2", "hello" } }; flash.Discard("test2"); flash.Sweep(); Assert.IsTrue(flash.ContainsKey("test1")); Assert.IsFalse(flash.ContainsKey("test2")); flash = new Flash(flash); flash.Sweep(); Assert.IsTrue(flash.Count == 0); flash.Add("test1", "hello"); flash.Add("test2", "hello"); flash.Discard(); flash = new Flash(flash); flash.Sweep(); Assert.IsFalse(flash.ContainsKey("test1")); Assert.IsFalse(flash.ContainsKey("test2")); flash = new Flash { { "test1", "hello" }, { "test1", "hello update" } }; Assert.AreEqual("hello update", flash["test1"]); flash.Discard("test1"); flash.Sweep(); Assert.IsFalse(flash.ContainsKey("test1")); }