public void Should_throw_exception_when_server_does_not_exist() { var putMatchResultsCommand = new PutMatchResultsCommand(string.Empty, DateTime.UtcNow, new MatchResultsDto()); var exception = Assert.ThrowsAsync<ValidationException>(async () => await _handler.Handle(putMatchResultsCommand)); Assert.AreEqual("Endpoint", exception.Property); }
public void Should_throw_exception_when_match_already_exists() { var timestamp = DateTime.UtcNow; _context.Servers.First().Matches.Add(new Match {Timestamp = timestamp}); _context.SaveChanges(); var putMatchResultsCommand = new PutMatchResultsCommand("LOCALhost", timestamp, new MatchResultsDto()); var exception = Assert.ThrowsAsync<ValidationException>(async () => await _handler.Handle(putMatchResultsCommand)); Assert.AreEqual("Timestamp", exception.Property); }