Esempio n. 1
0
 public async Task UnvoidMode_AsAdmin_ShouldReturnBadRequest_WhenUnknownPlant()
 => await ModesControllerTestsHelper.UnvoidModeAsync(
     UserType.LibraryAdmin, TestFactory.UnknownPlant,
     9999,
     TestFactory.AValidRowVersion,
     HttpStatusCode.BadRequest,
     "is not a valid plant");
Esempio n. 2
0
        public async Task UnvoidMode_AsAdmin_ShouldUnvoidMode()
        {
            // Arrange
            var id = await ModesControllerTestsHelper.CreateModeAsync(
                UserType.LibraryAdmin, TestFactory.PlantWithAccess,
                Guid.NewGuid().ToString());

            var mode = await ModesControllerTestsHelper.GetModeAsync(UserType.LibraryAdmin, TestFactory.PlantWithAccess, id);

            var currentRowVersion = await ModesControllerTestsHelper.VoidModeAsync(
                UserType.LibraryAdmin, TestFactory.PlantWithAccess,
                mode.Id,
                mode.RowVersion);

            // Act
            var newRowVersion = await ModesControllerTestsHelper.UnvoidModeAsync(
                UserType.LibraryAdmin, TestFactory.PlantWithAccess,
                mode.Id,
                currentRowVersion);

            // Assert
            mode = await ModesControllerTestsHelper.GetModeAsync(UserType.LibraryAdmin, TestFactory.PlantWithAccess, id);

            AssertRowVersionChange(currentRowVersion, newRowVersion);
            Assert.IsFalse(mode.IsVoided);
        }
Esempio n. 3
0
 public async Task UnvoidMode_AsPreserver_ShouldReturnForbidden_WhenPermissionMissing()
 => await ModesControllerTestsHelper.UnvoidModeAsync(
     UserType.Preserver, TestFactory.PlantWithAccess,
     9999,
     TestFactory.AValidRowVersion,
     HttpStatusCode.Forbidden);
Esempio n. 4
0
 public async Task UnvoidMode_AsAdmin_ShouldReturnForbidden_WhenNoAccessToPlant()
 => await ModesControllerTestsHelper.UnvoidModeAsync(
     UserType.LibraryAdmin, TestFactory.PlantWithoutAccess,
     9999,
     TestFactory.AValidRowVersion,
     HttpStatusCode.Forbidden);
Esempio n. 5
0
 public async Task UnvoidMode_AsAnonymous_ShouldReturnUnauthorized()
 => await ModesControllerTestsHelper.UnvoidModeAsync(
     UserType.Anonymous, TestFactory.UnknownPlant,
     9999,
     TestFactory.AValidRowVersion,
     HttpStatusCode.Unauthorized);