public void UploadImage_Student_Success() { string expectedLastName = "Wood"; string previousLastName = "Dubois"; string previousFirstName = "George"; EntityGenerator generator = new EntityGenerator(dbContext); Student student = generator.CreateStudentForUploadImage(previousLastName, previousFirstName); student.LastName = expectedLastName; FormDataHelper.PopulateFormData(controllerToTest, student); var stream = new MemoryStream(Encoding.UTF8.GetBytes("whatever")); MyTestPostedFileBase test = new MyTestPostedFileBase(stream, "whatever", "testImage.png"); var result = controllerToTest.EditPost(student.ID, test) as ViewResult; Student savedStudent = dbContext.Students.Find(student.ID); FileImage savedImage = dbContext.FileImages.Find(student.ID); Assert.That(result, Is.Not.Null); Assert.That(savedStudent, Is.Not.Null); Assert.That(savedImage, Is.Not.Null); }