public async Task Post() { TermOfPaymentViewModel VM = GenerateTestModel(); var response = await this.Client.PostAsync(URI, new StringContent(JsonConvert.SerializeObject(VM).ToString(), Encoding.UTF8, "application/json")); Assert.Equal(HttpStatusCode.Created, response.StatusCode); }
public TermOfPayment MapToModel(TermOfPaymentViewModel termOfPaymentVM) { TermOfPayment termOfPayment = new TermOfPayment(); PropertyCopier <TermOfPaymentViewModel, TermOfPayment> .Copy(termOfPaymentVM, termOfPayment); return(termOfPayment); }
public TermOfPaymentViewModel MapToViewModel(TermOfPayment termOfPayment) { TermOfPaymentViewModel termOfPaymentVM = new TermOfPaymentViewModel(); PropertyCopier <TermOfPayment, TermOfPaymentViewModel> .Copy(termOfPayment, termOfPaymentVM); return(termOfPaymentVM); }
public async Task Delete() { TermOfPayment TermOfPayment = await DataUtil.GetTestDataAsync(); TermOfPaymentViewModel VM = Service.MapToViewModel(TermOfPayment); var response = await this.Client.DeleteAsync(string.Concat(URI, "/", VM.Id)); Assert.Equal(HttpStatusCode.NoContent, response.StatusCode); }
public async Task Update() { TermOfPayment TermOfPayment = await DataUtil.GetTestDataAsync(); TermOfPaymentViewModel VM = Service.MapToViewModel(TermOfPayment); var response = await this.Client.PutAsync(string.Concat(URI, "/", VM.Id), new StringContent(JsonConvert.SerializeObject(VM).ToString(), Encoding.UTF8, "application/json")); Assert.Equal(HttpStatusCode.NoContent, response.StatusCode); }