public void TestDeleteVisitor() { BoraNowSeeder.Seed(); var vbo = new VisitorBusinessObject(); var resList = vbo.List(); var resDelete = vbo.Delete(resList.Result.First().Id); resList = vbo.List(); Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.First().IsDeleted); }
public void TestListVisitor() { BoraNowSeeder.Seed(); var vbo = new VisitorBusinessObject(); var resList = vbo.List(); Assert.IsTrue(resList.Success && resList.Result.Count == 1); }
public void TestUpdateVisitor() { BoraNowSeeder.Seed(); var vbo = new VisitorBusinessObject(); var resList = vbo.List(); var item = resList.Result.FirstOrDefault(); var countrybo = new CountryBusinessObject(); var pbo = new ProfileBusinessObject(); var companybo = new CompanyBusinessObject(); var country = new Country("Holanda"); var profile = new Profile("a", "b"); var company = new Company("a", "b", "c", "d", profile.Id); countrybo.Create(country); pbo.Create(profile); companybo.Create(company); var visitor = new Visitor("R", "f", DateTime.Now.AddYears(-24), "F", profile.Id, country.Id); item.FirstName = visitor.FirstName; item.LastName = visitor.LastName; item.BirthDate = visitor.BirthDate; item.Gender = visitor.Gender; item.ProfileId = visitor.ProfileId; item.CountryId = visitor.CountryId; var resUpdate = vbo.Update(item); resList = vbo.List(); Assert.IsTrue(resUpdate.Success && resList.Success && resList.Result.First().FirstName == visitor.FirstName && resList.Result.First().LastName == visitor.LastName && resList.Result.First().BirthDate == visitor.BirthDate && resList.Result.First().Gender == visitor.Gender && resList.Result.First().ProfileId == visitor.ProfileId && resList.Result.First().CountryId == visitor.CountryId); }
public ActionResult <List <VisitorViewModel> > List() { var res = _bo.List(); if (!res.Success) { return(new ObjectResult(HttpStatusCode.InternalServerError)); } var list = new List <VisitorViewModel>(); foreach (var item in res.Result) { list.Add(VisitorViewModel.Parse(item)); } return(list); }