Example #1
0
        public void ThenTheCarShouldBeAddedToTheSystemWithTheDetailsProvided()
        {
            _uiViewInfo.Should().NotBeNull();

            CarInfo storedCar = _actor.AsksFor(StoredCar.WithRegistration(_uiViewInfo.Registration));

            storedCar.Registration.Should().Be(_uiViewInfo.Registration);
            storedCar.Make.Should().Be(_uiViewInfo.Make);
            storedCar.Model.Should().Be(_uiViewInfo.Model);
        }
        public void ThenTheChangesShouldBeMadeToTheCarInTheSystem()
        {
            _updatedCarInput.Should().NotBeNull();

            CarInfo storedCar = _actor.AsksFor(StoredCar.WithRegistration(_updatedCarInput.Registration));

            storedCar.Registration.Should().Be(_updatedCarInput.Registration);
            storedCar.Make.Should().Be(_updatedCarInput.Make);
            storedCar.Model.Should().Be(_updatedCarInput.Model);
            storedCar.MotExpiry.Should().Be(_updatedCarInput.MotExpiry);
            storedCar.SuppressMotReminder.Should().Be(_updatedCarInput.SuppressMotReminder);
        }
        public void ThenTheCarShouldBeAddedToTheSystemWithTheDetailsProvided()
        {
            _newCarInput.Should().NotBeNull();

            CarInfo storedCar = _actor.AsksFor(StoredCar.WithRegistration(_newCarInput.Registration));

            storedCar.CustomerId.Should().Be(_newCarInput.CustomerId);
            storedCar.Make.Should().Be(_newCarInput.Make);
            storedCar.Model.Should().Be(_newCarInput.Model);
            storedCar.MotExpiry.Should().Be(_newCarInput.MotExpiry);
            storedCar.SuppressMotReminder.Should().Be(_newCarInput.SuppressMotReminder);
        }
        public void ThenTheFollowingCarsShouldBePresentInTheSystem(Table table)
        {
            table.Rows.ForEach(expectedValues =>
            {
                CarInfo storedCar = _actor.AsksFor(StoredCar.WithRegistration(expectedValues["Registration"]));

                storedCar.Should().NotBeNull();
                storedCar.Registration.Should().Be(expectedValues["Registration"]);
                storedCar.Make.Should().Be(expectedValues["Make"]);
                storedCar.Model.Should().Be(expectedValues["Model"]);
            });
        }
        public void ThenTheCarShouldRemainUnchangedInTheSystem()
        {
            _storedCar.Should().NotBeNull();

            CarInfo latestStoredCar = _actor.AsksFor(StoredCar.WithRegistration(_newCarInput.Registration));

            latestStoredCar.Registration.Should().Be(_storedCar.Registration);
            latestStoredCar.CustomerId.Should().Be(_storedCar.CustomerId);
            latestStoredCar.Make.Should().Be(_storedCar.Make);
            latestStoredCar.Model.Should().Be(_storedCar.Model);
            latestStoredCar.MotExpiry.Should().Be(_storedCar.MotExpiry);
            latestStoredCar.SuppressMotReminder.Should().Be(_storedCar.SuppressMotReminder);
        }
        public void GivenTheFollowingExistingCar(Table table)
        {
            var values = table.Rows.Single();

            _actor.AttemptsTo(DeleteCar.WithRegistration(values["Registration"]));

            int customerId = _actor.AsksFor(StoredCustomerId.ForName(values["Customer"]));

            _actor.AttemptsTo(
                InsertCar.WithRegistration(values["Registration"])
                .ForCustomer(customerId)
                .WithMake(values.GetStringOrDefault("Make"))
                .WithModel(values.GetStringOrDefault("Model"))
                .MotExpiringOn(values.GetDateOrDefault("MOT Expiry"))
                .SuppressingMotReminder(values.GetBoolOrDefault("Suppress MOT Reminder")));

            _storedCar = _actor.AsksFor(StoredCar.WithRegistration(values["Registration"]));
        }
        public void ThenThereShouldBeNoCarWithRegistration(string registration)
        {
            CarInfo storedCar = _actor.AsksFor(StoredCar.WithRegistration(registration));

            storedCar.Should().BeNull();
        }