public RestaurantPollVote(RestaurantPoll restaurantPoll, User voter, Restaurant restaurant, DateTime date) { Guard.Against.Null(restaurantPoll, nameof(restaurantPoll)); Guard.Against.Null(voter, nameof(voter)); Guard.Against.Null(restaurant, nameof(restaurant)); if (date <= DateTime.MinValue) { throw new ArgumentNullException(nameof(date)); } RestaurantPoll = restaurantPoll; Restaurant = restaurant; Voter = voter; Date = date; }
public RestaurantPollResult(Guid id, RestaurantPoll restaurantPoll, DateTime date, Restaurant winnerRestaurant, int totalVotes) { Guard.Against.NullOrEmpty(id, nameof(id)); Guard.Against.Null(restaurantPoll, nameof(restaurantPoll)); Guard.Against.Null(winnerRestaurant, nameof(winnerRestaurant)); Guard.Against.NegativeOrZero(totalVotes, nameof(totalVotes)); if (date <= DateTime.MinValue) { throw new ArgumentException("Invalid date"); } Id = id; RestaurantPoll = restaurantPoll; Date = date; WinnerRestaurant = winnerRestaurant; TotalVotes = totalVotes; }