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);
        }
        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);
        }
Exemplo n.º 3
0
 public async Task VoidStep_AsPreserver_ShouldReturnForbidden_WhenPermissionMissing()
 => await JourneysControllerTestsHelper.VoidStepAsync(
     UserType.Preserver, TestFactory.PlantWithAccess,
     9999,
     8888,
     TestFactory.AValidRowVersion,
     HttpStatusCode.Forbidden);
Exemplo n.º 4
0
 public async Task VoidStep_AsAdmin_ShouldReturnForbidden_WhenNoAccessToPlant()
 => await JourneysControllerTestsHelper.VoidStepAsync(
     UserType.LibraryAdmin, TestFactory.PlantWithoutAccess,
     9999,
     8888,
     TestFactory.AValidRowVersion,
     HttpStatusCode.Forbidden);
Exemplo n.º 5
0
 public async Task VoidStep_AsAnonymous_ShouldReturnUnauthorized()
 => await JourneysControllerTestsHelper.VoidStepAsync(
     UserType.Anonymous, TestFactory.UnknownPlant,
     9999,
     8888,
     TestFactory.AValidRowVersion,
     HttpStatusCode.Unauthorized);
Exemplo n.º 6
0
 public async Task VoidStep_AsAdmin_ShouldReturnBadRequest_WhenUnknownJourneyOrStepId()
 => await JourneysControllerTestsHelper.VoidStepAsync(
     UserType.LibraryAdmin, TestFactory.PlantWithAccess,
     JourneyNotInUseIdUnderTest,
     FirstStepInJourneyWithTagsIdUnderTest,     // step in other Journey
     TestFactory.AValidRowVersion,
     HttpStatusCode.BadRequest,
     "Journey and/or step doesn't exist!");
Exemplo n.º 7
0
 public async Task VoidStep_AsAdmin_ShouldReturnBadRequest_WhenUnknownPlant()
 => await JourneysControllerTestsHelper.VoidStepAsync(
     UserType.LibraryAdmin, TestFactory.UnknownPlant,
     9999,
     8888,
     TestFactory.AValidRowVersion,
     HttpStatusCode.BadRequest,
     "is not a valid plant");