public MeetupState TransitionTo(MeetupState toState) { if (_allowedTransitions.All(x => x != toState)) { throw new ArgumentException($"Invalid transition from {_name} to {toState._name}"); } return(toState); }
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)); }
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); }
public void MeetupStateInvalidTransitionTest(MeetupState from, MeetupState to) { Assert.False(from.CanTransitionTo(to)); Assert.Throws <ArgumentException>(() => from.TransitionTo(to)); }
public void MeetupStateValidTransitionTest(MeetupState from, MeetupState to) { Assert.True(from.CanTransitionTo(to)); Assert.Equal(to, from.TransitionTo(to)); }
public void Given_State_When_TransitionInvalidState_Then_Throws(MeetupState from, MeetupState to) => Assert.Throws <ArgumentException>(() => from.TransitionTo(to));
public void Given_State_When_TransitionAllowedState_Then_Transitioned(MeetupState from, MeetupState to) => Assert.Equal(to, from.TransitionTo(to));