public void Test_Location() { var numberOfSeats = 4; var number1 = NumberOfSeats.From(numberOfSeats); var number2 = NumberOfSeats.From(numberOfSeats); Assert.Equal(number1, number2); Assert.True(number1 == number2); }
public async Task <MeetupAggregate> Get(Guid meetupId) { var doc = await _collection.Find <MeetupMongoDocument>(doc => doc.Id == meetupId).FirstOrDefaultAsync(); if (doc == null) { return(null); } return(new MeetupAggregate( MeetupId.From(doc.Id), new MeetupTitle(doc.Title), Location.From(doc.Location), NumberOfSeats.From(doc.NumberOfSeats), doc.State.ToLower() switch { "published" => MeetupState.Published, "canceled" => MeetupState.Canceled, "created" => MeetupState.Created, _ => MeetupState.Created },
public void Given_ValidNumberOfSeats_When_Create_Then_Throws(int numberOfSeats) { var seats = NumberOfSeats.From(numberOfSeats); Assert.Equal(numberOfSeats, seats); }
public void Given_InvalidNumberOfSeats_When_Create_Then_Throws(int numberOfSeats) { Action meetup = () => NumberOfSeats.From(numberOfSeats); Assert.Throws <ArgumentException>(meetup); }