public async Task CanModifyArchiveDutyValues(ArchiveDutyRecommendationTypes recommendation) { //Arrange const int organizationId = TestEnvironment.DefaultOrganizationId; var comment = A <string>(); var system = await ItSystemHelper.CreateItSystemInOrganizationAsync(A <string>(), organizationId, AccessModifier.Public); var initialValues = await ItSystemHelper.GetSystemAsync(system.Id); //Act using (var changeDutyResponse = await ItSystemHelper.SendChangeArchiveDutyRecommendationRequestAsync(system.Id, recommendation)) using (var changeCommentResponse = await ItSystemHelper.SendChangeArchiveDutyRecommendationCommentRequestAsync(system.Id, comment)) { //Assert - initial and changed values Assert.Equal(HttpStatusCode.OK, changeDutyResponse.StatusCode); Assert.Equal(HttpStatusCode.OK, changeCommentResponse.StatusCode); Assert.Null(initialValues.ArchiveDuty); Assert.Null(initialValues.ArchiveDutyComment); var changedValues = await ItSystemHelper.GetSystemAsync(system.Id); Assert.Equal(recommendation, changedValues.ArchiveDuty); Assert.Equal(comment, changedValues.ArchiveDutyComment); } }
public static async Task <HttpResponseMessage> SendChangeArchiveDutyRecommendationRequestAsync(int systemId, ArchiveDutyRecommendationTypes recommendation) { var cookie = await HttpApi.GetCookieAsync(OrganizationRole.GlobalAdmin); var url = TestEnvironment.CreateUrl($"api/itsystem/{systemId}?{KitosApiConstants.UnusedOrganizationIdParameter}"); var body = new { archiveDuty = (int)recommendation }; return(await HttpApi.PatchWithCookieAsync(url, cookie, body)); }