public async Task AddSolution_HasRecoveryFields()
        {
            var assetId = await _addMinimalAssetHelper.AddMinimalAsset();

            var applicationNr      = "aa232";
            var applicationDate    = DateTime.Today;
            var recoveryDocType    = RecoveryDocumentType.Ordonanta;
            var issuingInstitution = "institution A";
            var request            = CreateSolutionRequest(applicationNr, applicationDate, recoveryDocType, issuingInstitution);

            var json          = JsonConvert.SerializeObject(request);
            var stringContent = new StringContent(json, Encoding.UTF8, "application/json");

            var response = await Client.PostAsync($"api/assets/{assetId}/solutions", stringContent);

            var data = await response.Content.ReadAsStringAsync();

            var viewModel = JsonConvert.DeserializeObject <SolutionViewModel>(data);

            var solution = Context.HistoricalStages.Find(viewModel.Id);

            Assert.Equal(applicationNr, solution.RecoveryApplicationNumber);
            Assert.Equal(applicationDate, solution.RecoveryApplicationDate);
            Assert.Equal(recoveryDocType, solution.RecoveryDocumentType);
            Assert.Equal(issuingInstitution, solution.RecoveryIssuingInstitution);
        }
예제 #2
0
        private async Task <OwnerViewModel> CreateOwnerWithApi(AddOwnerRequest request)
        {
            var assetId = await _addMinimalAssetHelper.AddMinimalAsset();


            var json          = JsonConvert.SerializeObject(request);
            var stringContent = new StringContent(json, Encoding.UTF8, "application/json");

            var response = await Client.PostAsync($"api/assets/{assetId}/owner", stringContent);

            response.EnsureSuccessStatusCode();

            var data = await response.Content.ReadAsStringAsync();

            var viewModel = JsonConvert.DeserializeObject <OwnerViewModel>(data);

            return(viewModel);
        }