public void GetInstructorById_InstructorIdExists_ReturnInstructor() { //Arrange Instructor instructor = generator.CreateInstructor("John", "Doe", "Doe", "Doe"); //Act var result = instructorBL.GetInstructorById(instructor.ID); //Assert Assert.That(result, Is.Not.Null); Assert.AreEqual(result.ID, instructor.ID); }
public void APIStudent_Fail_instructorID() { string instrLastName = "Adjara"; string instrFirstName = "Maria"; EntityGenerator generator = new EntityGenerator(dbContext); Instructor InstructorTest = generator.CreateInstructor(instrLastName, instrFirstName); IHttpActionResult notOkResult = controllerToTest.GetStudent(InstructorTest.ID); Assert.IsInstanceOf(typeof(NotFoundResult), notOkResult); }
public void GetDetails_ValidInstructor_Success() { string expectedLastName = "Dubois"; string expectedFirstName = "George"; EntityGenerator generator = new EntityGenerator(dbContext); Instructor instructor = generator.CreateInstructor(expectedLastName, expectedFirstName); var result = controllerToTest.Details(instructor.ID) as ViewResult; var resultModel = result.Model as Instructor; Assert.That(result, Is.Not.Null); Assert.That(resultModel, Is.Not.Null); Assert.That(expectedLastName, Is.EqualTo(resultModel.LastName)); Assert.That(expectedFirstName, Is.EqualTo(resultModel.FirstMidName)); }
public void Edit_ValidInstructorData_Success() { string expectedLastName = "Wood"; string previousLastName = "Dubois"; string previousFirstName = "George"; EntityGenerator generator = new EntityGenerator(dbContext); Instructor instructor = generator.CreateInstructor(previousLastName, previousFirstName); instructor.LastName = expectedLastName; FormDataHelper.PopulateFormData(controllerToTest, instructor); var result = controllerToTest.Edit(instructor.ID) as ViewResult; Instructor savedInstructor = dbContext.Instructors.Find(instructor.ID); Assert.That(result, Is.Not.Null); Assert.That((result.Model as Instructor).LastName, Is.EqualTo(expectedLastName)); Assert.That(savedInstructor.LastName, Is.EqualTo(expectedLastName)); }