public void Delete_WithNotExistingEducationPlan_ExceptionThrowed() { // Arrange IEducationPlanDataMapper dataMapper = new EducationPlanJsonDataMapper(_educationPlanPath, _updatedDirPath); // Act dataMapper.Delete(100); // Assert ArgumentException }
public void Insert_EducationPlanIsNull_ExceptionThrowed() { // Arrange IEducationPlanDataMapper dataMapper = new EducationPlanJsonDataMapper(_educationPlanPath, _updatedDirPath); // Act dataMapper.Insert(null); // Assert ArgumentNullException }
public void FindAllUpdated_WithCorruptedFile_ExceptionThrowed() { // Arrange IEducationPlanDataMapper dataMapper = new EducationPlanJsonDataMapper("../../Data/corrupted.json", _updatedDirPath); // Act var result = dataMapper.FindAllUpdated(); // Assert }
public void FindAllUpdated_UpdatedDir_ExceptionThrowed() { // Arrange IEducationPlanDataMapper dataMapper = new EducationPlanJsonDataMapper(_educationPlanPath, "noPath"); // Act var result = dataMapper.FindAllUpdated(); // Assert }
public void FindByIdWitNotExistingId_ExceptionThrowed() { // Arrange IEducationPlanDataMapper dataMapper = new EducationPlanJsonDataMapper(_educationPlanPath, _updatedDirPath); // Act var result = dataMapper.FindById(100); // Assert ArgumentException }
public void FindAllUpdated_WithNotExistingPath_ExceptionThrowed() { // Arrange IEducationPlanDataMapper dataMapper = new EducationPlanJsonDataMapper("NoPath", _updatedDirPath); // Act var result = dataMapper.FindAllUpdated(); // Assert }
public void Find_NoPlanFound() { // Arrange IEducationPlanDataMapper dataMapper = new EducationPlanJsonDataMapper(_educationPlanPath, _updatedDirPath); // Act var result = dataMapper.Find(educationPlan => educationPlan.NameEmployee == "Bram Aarts"); // Assert Assert.AreEqual(0, result.Count()); }
public void FindById_EducationPlanFound() { // Arrange IEducationPlanDataMapper dataMapper = new EducationPlanJsonDataMapper(_educationPlanPath, _updatedDirPath); // Act var result = dataMapper.FindById(1); // Assert Assert.AreEqual("Alex Verbeek", result.NameEmployee); }
public void Delete_EducationPlanDeleted() { // Arrange IEducationPlanDataMapper dataMapper = new EducationPlanJsonDataMapper(_educationPlanPath, _updatedDirPath); // Act dataMapper.Delete(1); // Assert var result = dataMapper.Find(ep => ep.NameEmployee == "Alex Verbeek"); Assert.AreEqual(0, result.Count()); }
public void Update_WithNotExistingEducationPlan_ExceptionThrowed() { // Arrange IEducationPlanDataMapper dataMapper = new EducationPlanJsonDataMapper(_educationPlanPath, _updatedDirPath); EducationPlan educationPlan = GetDummyEducationPlan(); educationPlan.Id = 100; // Act dataMapper.Update(educationPlan); // Assert ArgumentException }
public void Insert_EducationPlanInserted() { // Arrange IEducationPlanDataMapper dataMapper = new EducationPlanJsonDataMapper(_educationPlanPath, _updatedDirPath); EducationPlan educationPlan = GetDummyEducationPlan(); // Act var result = dataMapper.Insert(educationPlan); // Assert var educationPlans = dataMapper.Find(ep => ep.NameEmployee == "Pim Verheij"); Assert.AreEqual(1, educationPlans.Count()); Assert.AreEqual(4, result); }
public void Update_CheckNewUpdateFileWithOldData() { // Arrange IEducationPlanDataMapper dataMapper = new EducationPlanJsonDataMapper(_educationPlanPath, _updatedDirPath); EducationPlan educationPlan = GetDummyEducationPlan(); educationPlan.Id = 1; // Act var result = dataMapper.Update(educationPlan); // Assert Assert.AreEqual(1, result); Assert.IsTrue(File.Exists("../../Data/Updated/1.json")); }
public void Update_CheckNewUpdatedDirIsCreated() { // Arrange IEducationPlanDataMapper dataMapper = new EducationPlanJsonDataMapper(_educationPlanPath, _updatedDirPath); EducationPlan educationPlan = GetDummyEducationPlan(); educationPlan.Id = 1; if (Directory.Exists(_updatedDirPath)) { Directory.Delete(_updatedDirPath, true); } // Act dataMapper.Update(educationPlan); // Assert no exception thrown }
public void Update_EducationPlanUpdated() { // Arrange IEducationPlanDataMapper dataMapper = new EducationPlanJsonDataMapper(_educationPlanPath, _updatedDirPath); EducationPlan educationPlan = GetDummyEducationPlan(); educationPlan.Id = 1; var educationPlanBeforeUpdate = dataMapper.FindById(1); Assert.AreEqual("Alex Verbeek", educationPlanBeforeUpdate.NameEmployee); // Act var result = dataMapper.Update(educationPlan); // Assert var educationPlanTest = dataMapper.FindById(1); Assert.AreEqual("Pim Verheij", educationPlanTest.NameEmployee); Assert.AreEqual(1, result); }