예제 #1
0
 public async Task UpdateMode_AsPreserver_ShouldReturnForbidden_WhenPermissionMissing()
 => await ModesControllerTestsHelper.UpdateModeAsync(
     UserType.Preserver, TestFactory.PlantWithAccess,
     9999,
     "Mode1",
     TestFactory.AValidRowVersion,
     HttpStatusCode.Forbidden);
예제 #2
0
 public async Task UpdateMode_AsAdmin_ShouldReturnForbidden_WhenNoAccessToPlant()
 => await ModesControllerTestsHelper.UpdateModeAsync(
     UserType.LibraryAdmin, TestFactory.PlantWithoutAccess,
     9999,
     "Mode1",
     TestFactory.AValidRowVersion,
     HttpStatusCode.Forbidden);
예제 #3
0
 public async Task UpdateMode_AsAnonymous_ShouldReturnUnauthorized()
 => await ModesControllerTestsHelper.UpdateModeAsync(
     UserType.Anonymous, TestFactory.UnknownPlant,
     9999,
     "Mode1",
     TestFactory.AValidRowVersion,
     HttpStatusCode.Unauthorized);
예제 #4
0
 public async Task UpdateMode_AsAdmin_ShouldReturnBadRequest_WhenUnknownPlant()
 => await ModesControllerTestsHelper.UpdateModeAsync(
     UserType.LibraryAdmin, TestFactory.UnknownPlant,
     9999,
     "Mode1",
     TestFactory.AValidRowVersion,
     HttpStatusCode.BadRequest,
     "is not a valid plant");
예제 #5
0
        public async Task UpdateMode_AsAdmin_ShouldUpdateModeAndRowVersion()
        {
            var mode = await ModesControllerTestsHelper.GetModeAsync(UserType.LibraryAdmin, TestFactory.PlantWithAccess, _modeIdUnderTest);

            var currentRowVersion = mode.RowVersion;

            // Act
            var newRowVersion = await ModesControllerTestsHelper.UpdateModeAsync(
                UserType.LibraryAdmin, TestFactory.PlantWithAccess,
                mode.Id,
                Guid.NewGuid().ToString(),
                currentRowVersion);

            // Assert
            AssertRowVersionChange(currentRowVersion, newRowVersion);
        }