public void Insert_NewProfileAdded() { // Arrange IDataMapper <CourseProfile> dataMapper = new ProfileJsonDataMapper(_profilePath); CourseProfile profile = new CourseProfile { Name = "FrondEnd_Developer" }; // Act dataMapper.Insert(profile); // Assert var result = dataMapper.FindAll(); Assert.AreEqual(4, result.Count()); Assert.AreEqual("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()); Assert.AreEqual("FrondEnd_Developer", result.ElementAt(3).Name); Assert.AreEqual(0, result.ElementAt(3).Courses.Count()); Assert.AreEqual(4, result.ElementAt(3).Id); }
public void Insert_null_ExceptionThrowed() { // Arrange IDataMapper <CourseProfile> dataMapper = new ProfileJsonDataMapper(_profilePath); // Act dataMapper.Insert(null); // Assert ArgumentNullException }
public void Insert_ExistingProfile_ExceptionThrowed() { // Arrange IDataMapper <CourseProfile> dataMapper = new ProfileJsonDataMapper(_profilePath); CourseProfile profile = new CourseProfile { Name = "NET_Developer" }; // Act dataMapper.Insert(profile); // Assert ArgumentException }