public void TestGetAllCenters() { CenterInputModel centerModel = this.GetInputModel(); CenterInputModel centerTwoModel = this.GetInputModel(); centerTwoModel.Name = "New"; ICenterService centerService = new CenterService(this.dbContext); centerService.CreateCenter(centerModel); centerService.CreateCenter(centerTwoModel); var result = centerService.GetAllCenters().Count(); Assert.True(result != 0, "Centers count is incorrect!"); }
public void TestDeleteCenterByIncorrectId() { CenterInputModel centerModel = this.GetInputModel(); ICenterService centerService = new CenterService(this.dbContext); Center currentlyAdded = centerService.CreateCenter(centerModel); Center result = centerService.DeleteCenterById("invalid-id-55595"); Assert.Null(result); }
public void TestDeleteCenterById() { CenterInputModel centerModel = this.GetInputModel(); ICenterService centerService = new CenterService(this.dbContext); Center currentlyAdded = centerService.CreateCenter(centerModel); Center result = centerService.DeleteCenterById(currentlyAdded.Id); Assert.NotNull(result); }
public void TestCreateCenterMethodShouldAddToDbCorrectly() { CenterInputModel centerModel = this.GetInputModel(); ICenterService centerService = new CenterService(this.dbContext); Center result = centerService.CreateCenter(centerModel); int entitiesCount = this.dbContext.Centers.Count(); Assert.NotNull(result); }
public void TestGetCenterByIdShouldWorkCorrectly() { CenterInputModel centerModel = this.GetInputModel(); ICenterService centerService = new CenterService(this.dbContext); Center currentlyAdded = centerService.CreateCenter(centerModel); Center result = centerService.GetCenterById(currentlyAdded.Id); Center incorrectResult = centerService.GetCenterById(currentlyAdded.Id + "5"); Assert.NotNull(result); Assert.Null(incorrectResult); }
public void TestGetCenterByNameShouldWorkCorrectlyWithBothData() { CenterInputModel centerModel = this.GetInputModel(); ICenterService centerService = new CenterService(this.dbContext); Center currentlyAdded = centerService.CreateCenter(centerModel); Center result = centerService.GetCenterByName("SecondCenter"); Center resultShouldBeNull = centerService.GetCenterByName("SecondCenter1"); Assert.NotNull(result); Assert.Null(resultShouldBeNull); }
public void TestEditCenterShouldNotEditWhenFieldIsEmpty() { CenterInputModel centerModel = this.GetInputModel(); ICenterService centerService = new CenterService(this.dbContext); Center currentlyAdded = centerService.CreateCenter(centerModel); centerModel.Name = ""; centerModel.Id = currentlyAdded.Id; Center result = centerService.EditCenter(centerModel); Assert.True(result.Name == "SecondCenter"); }
public void TestEditCenterCorrectly() { CenterInputModel centerModel = this.GetInputModel(); ICenterService centerService = new CenterService(this.dbContext); Center currentlyAdded = centerService.CreateCenter(centerModel); centerModel.Name = "NameEdited"; centerModel.Id = currentlyAdded.Id; Center result = centerService.EditCenter(centerModel); Assert.True(result.Name == "NameEdited"); }
public void TestCreateCenterWithInvalidData() { CenterInputModel centerModel = new CenterInputModel() { Name = "SecondCenter", Town = "", Address = "bul. Vasil Levski 30", PhoneNumber = "08742457727", Email = "center2gmail.com" }; Center result = null; int entitiesCount = 0; ICenterService centerService = new CenterService(this.dbContext); result = centerService.CreateCenter(centerModel); entitiesCount = this.dbContext.Centers.Count(); Assert.Null(result); }