public void AddIllegalTest() { DBDistrict dB = new DBDistrict(this.dBConnect); dB.Create(new District() { Name = null }); }
public IActionResult Post([FromBody] DistrictDto dto) { try { provider.Create(dto.toDao()); return(Ok("District created succsessfully.")); } catch (Exception e) { return(BadRequest($"ERROR: {e.Message}")); } }
public void AddRemoveEntityTest() { DBDistrict dB = new DBDistrict(this.dBConnect); var sp = new District() { Name = "Netto", PSPID = 1 }; var stores = dB.GetAll(); var oldCount = stores.Count(); dB.Create(sp); Assert.IsTrue(dB.GetAll().Count() > oldCount, "District not created"); stores = dB.GetAll(); sp = stores.Last(); dB.Delete(sp.ID); Assert.IsTrue(dB.GetAll().Count() == oldCount, "District not removed"); }