public async Task <IActionResult> Details(string id) { var c = await reporitory.GetObject(id); await currencyes.LoadCurrencies(c); return(View(CountryViewFactory.Create(c))); }
[TestMethod] public void CreateNullTest() { var v = CountryViewFactory.Create(null); Assert.AreEqual(v.Name, Constants.Unspecified); Assert.AreEqual(v.ValidFrom, null); Assert.AreEqual(v.ValidTo, null); Assert.AreEqual(v.Alpha2Code, Constants.Unspecified); Assert.AreEqual(v.Alpha3Code, Constants.Unspecified); }
[TestMethod] public void CreateTest() { var o = GetRandom.Object <Country>(); var v = CountryViewFactory.Create(o); Assert.AreEqual(v.Name, o.Data.Name); Assert.AreEqual(v.ValidFrom, o.Data.ValidFrom); Assert.AreEqual(v.ValidTo, o.Data.ValidTo); Assert.AreEqual(v.Alpha2Code, o.Data.Code); Assert.AreEqual(v.Alpha3Code, o.Data.ID); }
[TestMethod] public void CreateWithExtremumDatesTest() { var o = GetRandom.Object <Country>(); o.Data.ValidFrom = DateTime.MinValue; o.Data.ValidTo = DateTime.MaxValue; var v = CountryViewFactory.Create(o); Assert.AreEqual(v.Name, o.Data.Name); Assert.AreEqual(v.ValidFrom, null); Assert.AreEqual(v.ValidTo, null); Assert.AreEqual(v.Alpha2Code, o.Data.Code); Assert.AreEqual(v.Alpha3Code, o.Data.ID); }
public static CurrencyView Create(Currency o) { var v = new CurrencyView { Name = o?.Data.Name, IsoCode = o?.Data.ID, Symbol = o?.Data.Code }; if (o is null) { return(v); } v.ValidFrom = setNullIfExtremum(o.Data.ValidFrom); v.ValidTo = setNullIfExtremum(o.Data.ValidTo); foreach (var c in o.UsedInCountries) { var country = CountryViewFactory.Create(c); v.UsedInCountries.Add(country); } return(v); }
public async Task <IActionResult> Edit(string id) { var c = await reporitory.GetObject(id); return(View(CountryViewFactory.Create(c))); }