public void SetByKeyAndGetByKeyWorksAsExpected() { // --- Arrange var context = new ServiceCallContext(); context.Clear(); // --- Act context.SetByKey("key1", 123); var item1 = context.GetByKey("key1"); context.SetByKey("key2", "hello"); var item2 = context.GetByKey("key2"); var item3 = context.GetByKey("key3"); // --- Assert item1.ShouldNotBeNull(); item1.ShouldEqual(123); item2.ShouldNotBeNull(); item2.ShouldEqual("hello"); item3.ShouldBeNull(); }
public void RemoveByKeyWorksAsExpected() { // --- Arrange var context = new ServiceCallContext(); context.Clear(); context.SetByKey("key1", 123); // --- Act var item1 = context.GetByKey("key1"); context.RemoveByKey("key1"); var item2 = context.GetByKey("key1"); // --- Assert item1.ShouldNotBeNull(); item2.ShouldBeNull(); }