public void GetAllTest() { DBSalesPerson dB = new DBSalesPerson(this.dBConnect); var ppl = dB.GetAll(); Assert.IsNotNull(ppl, "Null object returned"); Assert.IsTrue(ppl.Count() > 0, "There are no salesmen"); }
public IActionResult Get() { try { return(Ok(provider.GetAll().allToDto())); } catch (Exception e) { return(BadRequest($"ERROR: {e.Message}")); } }
public void AddRemoveEntityTest() { DBSalesPerson dB = new DBSalesPerson(this.dBConnect); var sp = new SalesPerson() { Name = "Johnny", Surname = "Test" }; var ppl = dB.GetAll(); var oldCount = ppl.Count(); dB.Create(sp); Assert.IsTrue(dB.GetAll().Count() > oldCount, "Salesperson not created"); ppl = dB.GetAll(); sp = ppl.Last(); dB.Delete(sp.ID); Assert.IsTrue(dB.GetAll().Count() == oldCount, "Salesperson not removed"); }