public async Task UnvoidStep_AsAdmin_ShouldUnvoidStep_AndUpdateRowVersion()
        {
            // Arrange
            var journeyIdUnderTest = TwoStepJourneyWithTagsIdUnderTest;
            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
            var newRowVersion = await JourneysControllerTestsHelper.UnvoidStepAsync(
                UserType.LibraryAdmin,
                TestFactory.PlantWithAccess,
                journeyIdUnderTest,
                stepId,
                currentRowVersion);

            // Assert
            AssertRowVersionChange(currentRowVersion, newRowVersion);
            step = await GetStepDetailsAsync(journeyIdUnderTest, stepId);

            Assert.IsFalse(step.IsVoided);
        }
Exemple #2
0
 public async Task UnvoidStep_AsPreserver_ShouldReturnForbidden_WhenPermissionMissing()
 => await JourneysControllerTestsHelper.UnvoidStepAsync(
     UserType.Preserver, TestFactory.PlantWithAccess,
     9999,
     8888,
     TestFactory.AValidRowVersion,
     HttpStatusCode.Forbidden);
Exemple #3
0
 public async Task UnvoidStep_AsAdmin_ShouldReturnForbidden_WhenNoAccessToPlant()
 => await JourneysControllerTestsHelper.UnvoidStepAsync(
     UserType.LibraryAdmin, TestFactory.PlantWithoutAccess,
     9999,
     8888,
     TestFactory.AValidRowVersion,
     HttpStatusCode.Forbidden);
Exemple #4
0
 public async Task UnvoidStep_AsAnonymous_ShouldReturnUnauthorized()
 => await JourneysControllerTestsHelper.UnvoidStepAsync(
     UserType.Anonymous, TestFactory.UnknownPlant,
     9999,
     8888,
     TestFactory.AValidRowVersion,
     HttpStatusCode.Unauthorized);
Exemple #5
0
 public async Task UnvoidStep_AsAdmin_ShouldReturnBadRequest_WhenUnknownJourneyOrStepId()
 => await JourneysControllerTestsHelper.UnvoidStepAsync(
     UserType.LibraryAdmin, TestFactory.PlantWithAccess,
     JourneyNotInUseIdUnderTest,
     FirstStepInJourneyWithTagsIdUnderTest,     // step in other Journey
     TestFactory.AValidRowVersion,
     HttpStatusCode.BadRequest,
     "Journey and/or step doesn't exist!");
Exemple #6
0
 public async Task UnvoidStep_AsAdmin_ShouldReturnBadRequest_WhenUnknownPlant()
 => await JourneysControllerTestsHelper.UnvoidStepAsync(
     UserType.LibraryAdmin, TestFactory.UnknownPlant,
     9999,
     8888,
     TestFactory.AValidRowVersion,
     HttpStatusCode.BadRequest,
     "is not a valid plant");