Example #1
0
        public async void return_a_201_http_status_code_when_creating_a_document()
        {
            WebApiConfig.Container.RegisterInstance(documentService);

            var document = new ComparableDocument().WithTitle(AnyTitle);
            var response = await restClient.PostAsJson("documents/", document);

            documentService.Received().Create(document);
            response.StatusCode.Should().Be(HttpStatusCode.Created);
        }
Example #2
0
        public async Task return_a_404_http_status_code_when_updating_no_existing_document()
        {
            GivenAWebApiWithDocumentServiceWithoutDocuments();

            var document = new ComparableDocument().WithId(AnyId);
            var response = await restClient.PutAsJson("documents/" + document.Id, document);

            documentService.Received().Update(document);
            response.StatusCode.Should().Be(HttpStatusCode.NotFound);
        }
Example #3
0
        public async void return_a_200_http_status_code_when_updated_a_document()
        {
            WebApiConfig.Container.RegisterInstance(documentService);

            var document = new ComparableDocument().WithId(AnyId);
            var response = await restClient.PutAsJson("documents/" + document.Id, document);

            documentService.Received().Update(document);
            response.StatusCode.Should().Be(HttpStatusCode.Accepted);
        }