public async Task Should_AttachPictureProduct_ForNonExistingProduct_Returns404() { //arrange var command = GetCreateProductCommand(); await CreateProductAsync(command); var addPictureCommand = new AddPictureCommand { Description = "Picture from Wadowice", Url = "http://ubiquitous.com/api/product/picture/2137", MimeTypeId = MimeType.Jpg.Id, Filename = "Picture #1" }; //act var addPicturePath = PicturesController.AddPicture(); var addResponse = await Client.PostAsJsonAsync(addPicturePath, addPictureCommand); var postStringResult = await addResponse.Content.ReadAsStringAsync(); var pictureResult = JsonConvert.DeserializeObject <PictureViewModel>(postStringResult); var attachPictureToProduct = ProductController.AttachPicture(Guid.NewGuid(), pictureResult.Id); var attachResponse = await Client.PostAsJsonAsync(attachPictureToProduct, new {}); //assert attachResponse.StatusCode.Should().Be(HttpStatusCode.NotFound); }
protected async Task <PictureViewModel> AddPicture() { var addPictureCommand = new AddPictureCommand { Description = "Picture from Wadowice", Url = "http://ubiquitous.com/api/product/picture/2137", MimeTypeId = MimeType.Jpg.Id, Filename = "Picture #1" }; var addPicturePath = PicturesController.AddPicture(); var addResponse = await Client.PostAsJsonAsync(addPicturePath, addPictureCommand); var addStringResult = await addResponse.Content.ReadAsStringAsync(); var pictureResult = JsonConvert.DeserializeObject <PictureViewModel>(addStringResult); addResponse.StatusCode.Should().Be(HttpStatusCode.Created); return(pictureResult); }