public async Task CurrentLocationAndFromMismatch_Exception() { var command = new MoveCharacterByTransitionCommand { CharacterId = 1, TransitionId = 2 }; Task Act() => _handler.Handle(command, CancellationToken.None); var ex = await Record.ExceptionAsync(Act) as CharacterCurrentLocationMismatchException; Assert.Null(_updatedCharacter); Assert.NotNull(ex); }
public async Task Ok() { var command = new MoveCharacterByTransitionCommand { CharacterId = 1, TransitionId = 1 }; var res = await _handler.Handle(command, CancellationToken.None); Assert.True(res); Assert.NotNull(_updatedCharacter); Assert.StrictEqual(1, _updatedCharacter.Id); Assert.NotNull(_updatedCharacter.CurrentLocation); Assert.StrictEqual(2, _updatedCharacter.CurrentLocation.Id); }
public async Task TransitionDoesNotExist_Exception() { var command = new MoveCharacterByTransitionCommand { CharacterId = 1, TransitionId = 5 }; Task Act() => _handler.Handle(command, CancellationToken.None); var ex = await Record.ExceptionAsync(Act) as EntityNotFoundException; Assert.Null(_updatedCharacter); Assert.NotNull(ex); Assert.Equal(5, ex.EntityId); Assert.IsType <EntityNotFoundException <Transition> >(ex); }