public async Task UpdateMode_AsPreserver_ShouldReturnForbidden_WhenPermissionMissing() => await ModesControllerTestsHelper.UpdateModeAsync( UserType.Preserver, TestFactory.PlantWithAccess, 9999, "Mode1", TestFactory.AValidRowVersion, HttpStatusCode.Forbidden);
public async Task UpdateMode_AsAdmin_ShouldReturnForbidden_WhenNoAccessToPlant() => await ModesControllerTestsHelper.UpdateModeAsync( UserType.LibraryAdmin, TestFactory.PlantWithoutAccess, 9999, "Mode1", TestFactory.AValidRowVersion, HttpStatusCode.Forbidden);
public async Task UpdateMode_AsAnonymous_ShouldReturnUnauthorized() => await ModesControllerTestsHelper.UpdateModeAsync( UserType.Anonymous, TestFactory.UnknownPlant, 9999, "Mode1", TestFactory.AValidRowVersion, HttpStatusCode.Unauthorized);
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");
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); }