public async Task StartRaffleWithoutEntrants() { await RaffleService.StartRaffle(false); Modal.Close(ModalResult.Ok(this)); StateHasChanged(); }
public async Task StartRaffleAsync_CurrentRaffleNotRunning_ReturnsValidId() { // arrange _currentRaffle.State = RaffleState.NotRunning; _updaterMock .Setup(updater => updater.CreateRaffle(It.IsAny <string>(), It.IsAny <Raffle>())) .ReturnsAsync(new object()); var svc = new RaffleService(_updaterMock.Object, _prizeServiceMock.Object, _configMock.Object, _loggerMock.Object) { LatestRaffle = _currentRaffle }; // act await svc.StartRaffle(); // assert Assert.IsTrue(_currentRaffle.State == RaffleState.Running); }
public async Task StartRaffleAsync_CurrentRaffleRunning_ThrowsApplicationException() { // arrange _currentRaffle.State = RaffleState.Running; var svc = new RaffleService(_updaterMock.Object, _prizeServiceMock.Object, _configMock.Object, _loggerMock.Object) { LatestRaffle = _currentRaffle }; // act // assert await Assert.ThrowsExceptionAsync <ApplicationException>(async() => await svc.StartRaffle()); }