public void AnAddedTableShouldBeReadable() { sut.AddCodeTable("0190", AddressTypesInstance()); Assert.NotNull(sut.GetCodeTable("0190")); Assert.Equal("Mailing Address", sut.GetTableValue("0190", "M")); Assert.Equal(string.Empty, sut.GetTableValue("0190", "Q")); }
public void CachedBehaviourWorksAsExpectedWhenFileIsCleared() { sut.AddCodeTable("0190", AddressTypesInstance()); sut.AddCodeTable("test", TestTypesInstance()); Assert.Equal("Mailing Address", sut.GetTableValue("0190", "M")); // cache table. Assert.Equal("one", sut.GetTableValue("test", "test1")); // cache table. Assert.Equal("Home Address", sutNoCache.GetTableValue("0190", "H")); Assert.Equal("two", sutNoCache.GetTableValue("test", "test2")); // delete the file using the NON cached version, so only the cached version should work. sutNoCache.Clear("0190"); Assert.Equal("Home Address", sut.GetTableValue("0190", "H")); Assert.Equal(String.Empty, sutNoCache.GetTableValue("0190", "M")); Assert.Equal("three", sutNoCache.GetTableValue("test", "test3")); // delete the TEST file using the cached version, neither Test should now work, but 0190 will still work on cached. sut.Clear("test"); Assert.Equal(String.Empty, sutNoCache.GetTableValue("0190", "M")); Assert.Equal(String.Empty, sutNoCache.GetTableValue("test", "test3")); Assert.Equal(String.Empty, sut.GetTableValue("test", "test3")); Assert.Equal("Home Address", sut.GetTableValue("0190", "H")); Assert.Equal("Current Address", sut.GetTableValue("0190", "C")); }