public async Task CreateAlbumShouldReturnOkIfTitleAndDescriptionAreProvided() { // Arrange var pictureService = new Mock <IPictureService>(); var userManager = MockManager.GetMockUserManger(); pictureService .Setup(s => s.CreateAlbumAsync(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())) .ReturnsAsync(true); userManager .Setup(s => s.GetUserId(It.IsAny <ClaimsPrincipal>())) .Returns(Guid.NewGuid().ToString()); var controller = new PhotosController(pictureService.Object, null, userManager.Object); controller.LoginMockUser(); // Act var result = await controller.CreateAlbum("fakeTitle", "fakeDescription"); // Assert result .Should() .BeOfType <OkResult>(); }
public async Task CreateAlbumShouldReturnBadRequestIfDescriptionIsNotProvided() { // Arrange var pictureService = new Mock <IPictureService>(); pictureService .Setup(s => s.CreateAlbumAsync(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())) .ReturnsAsync(true); var controller = new PhotosController(pictureService.Object, null, null); // Act var result = await controller.CreateAlbum("fakeTitle", null); // Assert result .Should() .BeOfType <BadRequestObjectResult>(); }