Beispiel #1
0
        public async Task Post()
        {
            StandardTestsViewModel standardTestsViewModel = GenerateTestModel();
            var response = await this.Client.PostAsync(URI, new StringContent(JsonConvert.SerializeObject(standardTestsViewModel).ToString(), Encoding.UTF8, "application/json"));

            Assert.Equal(HttpStatusCode.Created, response.StatusCode);
        }
        public StandardTestsViewModel MapToViewModel(StandardTests model)
        {
            StandardTestsViewModel viewModel = new StandardTestsViewModel();

            PropertyCopier <StandardTests, StandardTestsViewModel> .Copy(model, viewModel);

            return(viewModel);
        }
        public StandardTests MapToModel(StandardTestsViewModel viewModel)
        {
            StandardTests model = new StandardTests();

            PropertyCopier <StandardTestsViewModel, StandardTests> .Copy(viewModel, model);

            return(model);
        }
Beispiel #4
0
        public StandardTestsViewModel GetEmptyData()
        {
            StandardTestsViewModel Data = new StandardTestsViewModel();

            Data.Name   = "";
            Data.Code   = "";
            Data.Remark = "";
            return(Data);
        }
Beispiel #5
0
        public async Task Update()
        {
            StandardTests standard = await DataUtil.GetTestDataAsync();

            StandardTestsViewModel VM = Service.MapToViewModel(standard);
            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);
        }
Beispiel #6
0
        public async Task Delete()
        {
            StandardTests standard = await DataUtil.GetTestDataAsync();

            StandardTestsViewModel VM = Service.MapToViewModel(standard);
            var response = await this.Client.DeleteAsync(string.Concat(URI, "/", VM.Id));

            Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);
        }