public void Update_null_ExceptionThrowed() { // Arrange IDataMapper <CourseProfile> dataMapper = new ProfileJsonDataMapper(_profilePath); // Act dataMapper.Update(null); // Assert ArgumentNullException }
public void Update_WithNotExistingProfile_ExceptionThrowed() { // Arrange IDataMapper <CourseProfile> dataMapper = new ProfileJsonDataMapper(_profilePath); CourseProfile profile = new CourseProfile { Id = 100, Name = "DOT_NET_Developer" }; // Act dataMapper.Update(profile); // Assert ArgumentException }
public void Update_ProfileUpdated() { // Arrange IDataMapper <CourseProfile> dataMapper = new ProfileJsonDataMapper(_profilePath); CourseProfile profile = new CourseProfile { Id = 1, Name = "DOT_NET_Developer" }; // Act dataMapper.Update(profile); // Assert var result = dataMapper.FindAll(); Assert.AreEqual(3, result.Count()); Assert.AreEqual("DOT_NET_Developer", result.ElementAt(0).Name); Assert.AreEqual(31, result.ElementAt(0).Courses.Count()); Assert.AreEqual("Developer_Mobile", result.ElementAt(1).Name); Assert.AreEqual(30, result.ElementAt(1).Courses.Count()); Assert.AreEqual("JAVA_Developer", result.ElementAt(2).Name); Assert.AreEqual(27, result.ElementAt(2).Courses.Count()); }