コード例 #1
0
        public async Task Create_EndpointReturnSuccessAndCorrectContentType()
        {
            try
            {
                // Arrange
                var record = new FieldNaming
                {
                    ModelFieldName = FIELD_NAME,
                    PdfFieldName   = PDF_NAME,
                    Page           = 1
                };

                var response = await this.Client.PostAsync("/api/FieldNamings", record.GetStringContent());

                // Assert
                Assert.Equal("application/json; charset=utf-8", response.Content.Headers.ContentType.ToString());
                var returnedRecord = response.ContentAsType <FieldNaming>();
                Assert.Equal(record.ModelFieldName, returnedRecord.ModelFieldName);
                Assert.Equal(record.PdfFieldName, returnedRecord.PdfFieldName);
                Assert.Equal(record.Page, returnedRecord.Page);
            }
            finally
            {
                //Clear Data
                await ClearAll();
            }
        }
コード例 #2
0
        public async Task Update_EndpointReturnNotFound()
        {
            // Arrange
            var record = new FieldNaming
            {
                ModelFieldName = FIELD_NAME,
                PdfFieldName   = PDF_NAME,
                Page           = 1
            };

            //Act
            var response = await(this.Client.PutAsync($"api/FieldNamings/{FIELD_NAME}", record.GetStringContent()));

            // Assert
            Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
        }