public void ReturnsNullStateIfKeyIsNull() { TestSharedStateFactory p = new TestSharedStateFactory(); // force provider to produce a null key IDictionary state = p.GetSharedStateFor(TestSharedStateFactory.SPECIAL_OBJECT, null); Assert.IsNull(state); }
public void DefaultsToCaseInsensitiveState() { TestSharedStateFactory p = new TestSharedStateFactory(); Assert.IsFalse(p.CaseSensitiveState); IDictionary state = p.GetSharedStateFor(new object(), "no name" ); state["foo"] = this; Assert.AreSame(this, state["FOO"]); }
public void ThrowsOnNullInstance() { TestSharedStateFactory p = new TestSharedStateFactory(); // allow "null" for name IDictionary state = p.GetSharedStateFor(new object(), null); Assert.IsNotNull(state); // throws on null for instance Assert.Throws<ArgumentNullException>(() => p.GetSharedStateFor(null, "no name")); }
public void ThrowsOnNullInstance() { TestSharedStateFactory p = new TestSharedStateFactory(); // allow "null" for name IDictionary state = p.GetSharedStateFor(new object(), null); Assert.IsNotNull(state); // throws on null for instance Assert.Throws <ArgumentNullException>(() => p.GetSharedStateFor(null, "no name")); }
public void DefaultsToCaseInsensitiveState() { TestSharedStateFactory p = new TestSharedStateFactory(); Assert.IsFalse(p.CaseSensitiveState); IDictionary state = p.GetSharedStateFor(new object(), "no name"); state["foo"] = this; Assert.AreSame(this, state["FOO"]); }
public void SharedStateCacheIsCaseSensitive() { TestSharedStateFactory p = new TestSharedStateFactory(); // allow "null" for name IDictionary state = p.GetSharedStateFor(this, "foo"); IDictionary state2 = p.GetSharedStateFor(this, "FOO"); Assert.IsNotNull(state); Assert.IsNotNull(state2); Assert.AreNotSame(state, state2); }
public void StateDictionaryBehavesAccordingToCaseSensitiveState() { TestSharedStateFactory p = new TestSharedStateFactory(); // create case-insensitive dict Assert.IsFalse(p.CaseSensitiveState); IDictionary state = p.GetSharedStateFor(new object(), "no name" ); state["foo"] = this; Assert.AreSame(this, state["FOO"]); // create case-sensitive dict p.CaseSensitiveState = true; state = p.GetSharedStateFor(new object(), "no name" ); state["foo"] = this; Assert.IsFalse(state.Contains("FOO")); }
public void StateDictionaryBehavesAccordingToCaseSensitiveState() { TestSharedStateFactory p = new TestSharedStateFactory(); // create case-insensitive dict Assert.IsFalse(p.CaseSensitiveState); IDictionary state = p.GetSharedStateFor(new object(), "no name"); state["foo"] = this; Assert.AreSame(this, state["FOO"]); // create case-sensitive dict p.CaseSensitiveState = true; state = p.GetSharedStateFor(new object(), "no name"); state["foo"] = this; Assert.IsFalse(state.Contains("FOO")); }