public async Task DeleteStep_AsAdmin_ShouldDeleteStep() { // Arrange var journeyIdUnderTest = JourneyNotInUseIdUnderTest; var stepId = await JourneysControllerTestsHelper.CreateStepAsync( UserType.LibraryAdmin, TestFactory.PlantWithAccess, journeyIdUnderTest, Guid.NewGuid().ToString(), OtherModeIdUnderTest, KnownTestData.ResponsibleCode); var step = await GetStepDetailsAsync(journeyIdUnderTest, stepId); var currentRowVersion = await JourneysControllerTestsHelper.VoidStepAsync( UserType.LibraryAdmin, TestFactory.PlantWithAccess, journeyIdUnderTest, stepId, step.RowVersion); // Act await JourneysControllerTestsHelper.DeleteStepAsync( UserType.LibraryAdmin, TestFactory.PlantWithAccess, journeyIdUnderTest, stepId, currentRowVersion); // Assert step = await GetStepDetailsAsync(journeyIdUnderTest, stepId); Assert.IsNull(step); }
public async Task DeleteStep_AsPreserver_ShouldReturnForbidden_WhenPermissionMissing() => await JourneysControllerTestsHelper.DeleteStepAsync( UserType.Preserver, TestFactory.PlantWithAccess, 9999, 8888, TestFactory.AValidRowVersion, HttpStatusCode.Forbidden);
public async Task DeleteStep_AsAdmin_ShouldReturnForbidden_WhenNoAccessToPlant() => await JourneysControllerTestsHelper.DeleteStepAsync( UserType.LibraryAdmin, TestFactory.PlantWithoutAccess, 9999, 8888, TestFactory.AValidRowVersion, HttpStatusCode.Forbidden);
public async Task DeleteStep_AsAnonymous_ShouldReturnUnauthorized() => await JourneysControllerTestsHelper.DeleteStepAsync( UserType.Anonymous, TestFactory.UnknownPlant, 9999, 8888, TestFactory.AValidRowVersion, HttpStatusCode.Unauthorized);
public async Task DeleteStep_AsAdmin_ShouldReturnBadRequest_WhenUnknownJourneyOrStepId() => await JourneysControllerTestsHelper.DeleteStepAsync( UserType.LibraryAdmin, TestFactory.PlantWithAccess, JourneyNotInUseIdUnderTest, FirstStepInJourneyWithTagsIdUnderTest, // step in other Journey TestFactory.AValidRowVersion, HttpStatusCode.BadRequest, "Journey and/or step doesn't exist!");
public async Task DeleteStep_AsAdmin_ShouldReturnBadRequest_WhenUnknownPlant() => await JourneysControllerTestsHelper.DeleteStepAsync( UserType.LibraryAdmin, TestFactory.UnknownPlant, 9999, 8888, TestFactory.AValidRowVersion, HttpStatusCode.BadRequest, "is not a valid plant");