public void GetListOfAllPhotographs() { //Arrange PhotographController photoController = new PhotographController(_photographServices); var photoListToReturn = new List<Photograph>(); var projectList = new List<Project>(); projectList.Add( new Project { ProjectId = Guid.NewGuid(), Title = "Project Title", Description = "Description tex" } ); projectList.Add( new Project { ProjectId = Guid.NewGuid(), Title = "Project Title 2", Description = "Description tex2" } ); Photograph photo1 = new Photograph { PhotographId = Guid.NewGuid(), Title = "Test title", Location = "Test location", Projects = projectList }; Photograph photo2 = new Photograph { PhotographId = Guid.NewGuid(), Title = "Test title 2", Location = "Test location 2", Projects = projectList }; photoListToReturn.Add(photo1); photoListToReturn.Add(photo2); _photographServices.GetAllPhotographs().Returns(photoListToReturn); var result = photoController.ListOfPhotos() as ViewResult; var photographList = result.Model as List<Photograph>; Assert.IsNotNull(result); Assert.AreEqual(photographList, new[] { photo1, photo2 }); }
public void UploadFileGoesToResult() { // Arrange PhotographController controller = new PhotographController(null); // Act ViewResult result = controller.Upload() as ViewResult; // Assert Assert.IsNotNull(result); }
public void UploadedFileSavedToServer() { //Arrange PhotographController controller = new PhotographController(null); //Act ViewResult result = controller.Upload() as ViewResult; //Assert string filePathResult = null; string actualFile = Path.GetFileName(filePathResult); Assert.IsNotNull(actualFile); Assert.AreNotEqual(String.Empty, actualFile); Assert.IsNotNull(result); }