Esempio n. 1
0
        public MeetupState TransitionTo(MeetupState toState)
        {
            if (_allowedTransitions.All(x => x != toState))
            {
                throw new ArgumentException($"Invalid transition from {_name} to {toState._name}");
            }

            return(toState);
        }
Esempio n. 2
0
 public void Given_Invalid_Meetup_When_Build_Then_Throws(MeetupState state)
 {
     Assert.Throws <MeetupDomainException>(() =>
                                           new Meetup(
                                               MeetupId.From(id),
                                               MeetupTitle.From(title),
                                               Address.None,
                                               SeatsNumber.From(numberOfSeats),
                                               timeRange,
                                               state));
 }
Esempio n. 3
0
        public void Given_Valid_Meetup_When_Build_Then_Built(MeetupState state)
        {
            var meetup = new Meetup(
                MeetupId.From(id),
                MeetupTitle.From(title),
                Address.From(address),
                SeatsNumber.From(numberOfSeats),
                timeRange,
                state);

            Assert.Equal(id, meetup.Id);
            Assert.Equal(title, meetup.Title);
            Assert.Equal(address, meetup.Location);
            Assert.Equal(numberOfSeats, meetup.NumberOfSeats);
            Assert.Equal(timeRange, meetup.TimeRange);
            Assert.Equal(state, meetup.State);
        }
Esempio n. 4
0
 public void MeetupStateInvalidTransitionTest(MeetupState from, MeetupState to)
 {
     Assert.False(from.CanTransitionTo(to));
     Assert.Throws <ArgumentException>(() => from.TransitionTo(to));
 }
Esempio n. 5
0
 public void MeetupStateValidTransitionTest(MeetupState from, MeetupState to)
 {
     Assert.True(from.CanTransitionTo(to));
     Assert.Equal(to, from.TransitionTo(to));
 }
Esempio n. 6
0
 public void Given_State_When_TransitionInvalidState_Then_Throws(MeetupState from, MeetupState to) =>
 Assert.Throws <ArgumentException>(() => from.TransitionTo(to));
Esempio n. 7
0
 public void Given_State_When_TransitionAllowedState_Then_Transitioned(MeetupState from, MeetupState to) =>
 Assert.Equal(to, from.TransitionTo(to));