Example #1
0
        /*
         * A customer with id card equal to id, gets in the station stationName at time t.
         * A customer can only be checked into one place at a time.
         */
        public void CheckIn(int id, string stationName, int t)
        {
            //if (IsInvalidID(id) || IsInvalidTime(t) || IsInvalidStationName(stationName))
            //    return;

            CustomerTrip trip = new CustomerTrip();

            trip.CheckInStation = stationName;
            trip.CustomerId     = id;
            trip.CheckInTime    = t;

            CheckinCheckoutSchedule.Add(trip);
        }
Example #2
0
        public void add_duplicated_trip_expect_exception()
        {
            var customer = new Customer(Guid.NewGuid(), "Jar", "Jar");
            var now      = DateTimeOffset.Now;
            var trip     = new Trip(Guid.NewGuid(), "TripName", "Destination", now,
                                    now + TimeSpan.FromDays(2), new MockedDateOffsetProvider(now.ToUniversalTime()));
            var customerTrip = new CustomerTrip(Guid.NewGuid(), customer, trip);

            customer.AddTrip(customerTrip);
            Action act = () => customer.AddTrip(customerTrip);

            act.Should().Throw <DomainException>().Where(ex =>
                                                         ex.ErrorCode == DomainErrorCodes.CustomerAlreadyAssignedToThisTrip);
        }