public void TestElectrocardiogramUploadValid() { //Arrange Mock <IAttachmentRepository> attachmentRepository = new Mock <IAttachmentRepository>(); AttachmentController controller = new AttachmentController(attachmentRepository.Object); string fileName = "file.pdf"; var stream = new MemoryStream(new byte[] { 1, 2, 3, 4 }); Mock <HttpPostedFile> httpFile = new Mock <HttpPostedFile>(); httpFile.SetupGet(f => f.FileName).Returns(fileName); var args = new FileUploadCompleteEventArgs( string.Empty, true, string.Empty, new UploadedFile(httpFile.Object)); //Act controller.OnElectrocardiogramUploadComplete(null, args); //Assert }