public void TestCache() { CacheTest notNull = new CacheTest { Age = 0, Name = string.Empty, Tags = new List <string>(), Ids = new List <int>() }; string expectedQuery = "Age=0&Name="; Assert.Equal(expectedQuery, notNull.ToCacheKey()); CacheTest nullable = new CacheTest { Age = null, Name = null, Tags = null, Ids = null }; string expectedQuery2 = "Tags=Null&Ids=Null"; Assert.Equal(expectedQuery2, nullable.ToCacheKey()); CacheTest defaultTest = new CacheTest { Age = 0, Name = string.Empty, Tags = new List <string> { string.Empty }, Ids = new List <int> { 0 } }; string expectedQuery3 = "Age=0&Name=&Tags=&Ids=0"; Assert.Equal(expectedQuery3, defaultTest.ToCacheKey()); Assert.NotEqual(nullable.ToCacheKey(), defaultTest.ToCacheKey()); Assert.NotEqual(notNull.ToCacheKey(), defaultTest.ToCacheKey()); Assert.NotEqual(notNull.ToCacheKey(), nullable.ToCacheKey()); }