public void CtorTestEmpty() { var json = "{}"; repositoryCountries = new RepositoryCountries(json); Dictionary <string, string> expectedDictionary = new Dictionary <string, string>(); var actual = repositoryCountries.GetType().GetRuntimeFields().First(f => f.Name.Equals("_countriesDict")) .GetValue(repositoryCountries) as Dictionary <string, string>; CollectionAssert.AreEqual(expectedDictionary, actual); }
public void CtorTestOneElement() { var json = "{\"AD\": \"Андорра\"}"; repositoryCountries = new RepositoryCountries(json); Dictionary <string, string> expectedDictionary = new Dictionary <string, string>(); expectedDictionary.Add("AD", "Андорра"); var actual = repositoryCountries.GetType().GetRuntimeFields().First(f => f.Name.Equals("_countriesDict")) .GetValue(repositoryCountries) as Dictionary <string, string>; CollectionAssert.AreEqual(expectedDictionary, actual); }
public void CtorTestManyElements() { var json = "{\"AD\": \"Андорра\",\"AE\": \"Объединенные Арабские Эмираты\",\"AB\": \"Объединенные Арабские Эмираты\",\"AF\": \"Объединенные Арабские Эмираты\",\"AR\": \"Объединенные Арабские Эмираты\"}"; repositoryCountries = new RepositoryCountries(json); Dictionary <string, string> expectedDictionary = new Dictionary <string, string>(); expectedDictionary.Add("AD", "Андорра"); expectedDictionary.Add("AE", "Объединенные Арабские Эмираты"); expectedDictionary.Add("AB", "Объединенные Арабские Эмираты"); expectedDictionary.Add("AF", "Объединенные Арабские Эмираты"); expectedDictionary.Add("AR", "Объединенные Арабские Эмираты"); var actual = repositoryCountries.GetType().GetRuntimeFields().First(f => f.Name.Equals("_countriesDict")) .GetValue(repositoryCountries) as Dictionary <string, string>; CollectionAssert.AreEqual(expectedDictionary, actual); }