Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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
            },
Esempio n. 3
0
        public void Given_ValidNumberOfSeats_When_Create_Then_Throws(int numberOfSeats)
        {
            var seats = NumberOfSeats.From(numberOfSeats);

            Assert.Equal(numberOfSeats, seats);
        }
Esempio n. 4
0
        public void Given_InvalidNumberOfSeats_When_Create_Then_Throws(int numberOfSeats)
        {
            Action meetup = () => NumberOfSeats.From(numberOfSeats);

            Assert.Throws <ArgumentException>(meetup);
        }