public SettingManager_User_Tests() { _settingManager = GetRequiredService <ISettingManager>(); _settingProvider = GetRequiredService <ISettingProvider>(); _testData = GetRequiredService <SettingTestData>(); }
private void ReloadTestData() { if (PersonTestData == default) { PersonTestData = new List <PersonEntity>(); } if (SettingTestData == default) { SettingTestData = new List <SettingEntity>(); } if (SettingDevelopmentTestData == default) { SettingDevelopmentTestData = new List <SettingEntity>(); } if (SettingMobileTestData == default) { SettingMobileTestData = new List <SettingEntity>(); } if (SettingMobileDevelopmentTestData == default) { SettingMobileDevelopmentTestData = new List <SettingEntity>(); } PersonTestData.Clear(); SettingTestData.Clear(); SettingDevelopmentTestData.Clear(); SettingMobileTestData.Clear(); SettingMobileDevelopmentTestData.Clear(); using (StreamReader file = File.OpenText("persontestdata.json")) { Newtonsoft.Json.JsonSerializer serializer = new Newtonsoft.Json.JsonSerializer(); PersonTestData.AddRange((List <PersonEntity>)serializer.Deserialize(file, typeof(List <PersonEntity>))); } using (StreamReader file = File.OpenText("settingtestdata.json")) { JObject fileAsJson = JObject.Parse(file.ReadToEnd()); foreach (KeyValuePair <string, JToken> entry in fileAsJson) { SettingTestData.Add(new SettingEntity() { Key = entry.Key, Value = entry.Value.ToString(), Application = "", Environment = "" }); } } using (StreamReader file = File.OpenText("settingtestdata.Development.json")) { JObject fileAsJson = JObject.Parse(file.ReadToEnd()); foreach (KeyValuePair <string, JToken> entry in fileAsJson) { SettingDevelopmentTestData.Add(new SettingEntity() { Key = entry.Key, Value = entry.Value.ToString(), Application = "", Environment = "Development" }); } } using (StreamReader file = File.OpenText("settingtestdata.Mobile.json")) { JObject fileAsJson = JObject.Parse(file.ReadToEnd()); foreach (KeyValuePair <string, JToken> entry in fileAsJson) { SettingMobileTestData.Add(new SettingEntity() { Key = entry.Key, Value = entry.Value.ToString(), Application = "Mobile", Environment = "" }); } } using (StreamReader file = File.OpenText("settingtestdata.Mobile.Development.json")) { JObject fileAsJson = JObject.Parse(file.ReadToEnd()); foreach (KeyValuePair <string, JToken> entry in fileAsJson) { SettingMobileDevelopmentTestData.Add(new SettingEntity() { Key = entry.Key, Value = entry.Value.ToString(), Application = "Mobile", Environment = "Development" }); } } }
protected SettingRepository_Tests() { SettingRepository = GetRequiredService <ISettingRepository>(); TestData = GetRequiredService <SettingTestData>(); }