public async Task <IActionResult> CreateTelecom( [Bind(telecomProperties)] TelecomAddressView c) { if (!ModelState.IsValid) { return(View(c)); } c.ID = c.ID ?? Guid.NewGuid().ToString(); var o = AddressFactory.CreateDevice(c.ID, c.CountryCode, c.AreaCode, c.Number, c.Extension, c.NationalDirectDialingPrefix, c.DeviceType, c.ValidFrom, c.ValidTo); await addresses.AddObject(o); return(RedirectToAction("Index")); }
[TestMethod] public void CreateDeviceTest() { var r = GetRandom.Object <TelecomAddressData>(); var o = AddressFactory.CreateDevice( r.ID, r.RegionOrStateOrCountryCode, r.CityOrAreaCode, r.Address, r.ZipOrPostCodeOrExtension, r.NationalDirectDialingPrefix, r.Device, r.ValidFrom, r.ValidTo); Assert.IsInstanceOfType(o, typeof(TelecomAddress)); testVariables(o.Data, r.ID, r.Address, r.ValidFrom, r.ValidTo, r.CityOrAreaCode, r.RegionOrStateOrCountryCode, o.Data.ZipOrPostCodeOrExtension); Assert.AreEqual(r.NationalDirectDialingPrefix, o.Data.NationalDirectDialingPrefix); Assert.AreEqual(r.Device, o.Data.Device); }