public async Task AddVehicleToCustomer_Should_ThrowException_OnDuplicateRegistration()
        {
            // Arrange
            var sut      = new CustomerVehicleService(repo, new MockVehicleDataService());
            var req      = "LD66OFZ";
            var custId   = Guid.NewGuid();
            var clientId = Guid.NewGuid();
            await sut.AddVehicleToCustomer(req, custId, clientId);

            // Act & Assert
            await Assert.ThrowsAsync <Exception>(async() => await sut.AddVehicleToCustomer(req, custId, clientId));
        }
        public async Task AddVehicleToCustomer_Should_ReturnAVehicle()
        {
            // Arrange
            var sut = new CustomerVehicleService(repo, new MockVehicleDataService());
            // Act
            var result = await sut.AddVehicleToCustomer("EF02VCC", Guid.NewGuid(), Guid.NewGuid());

            // Assert
            Assert.IsType <CustomerVehicle>(result);
        }
        public async Task AddVehicleToCustomer_Should_HaveEmptyServiceData()
        {
            // Arrange
            var sut = new CustomerVehicleService(repo, new MockVehicleDataService());
            // Act
            var result = await sut.AddVehicleToCustomer("EF02VCC", Guid.NewGuid(), Guid.NewGuid());

            // Assert
            Assert.NotNull(result.ServiceData);
        }
        public async Task AddVehileToCustomer_Should_HaveAtleastOneMotComment()
        {
            // Arrange
            var sut = new CustomerVehicleService(repo, new MockVehicleDataService());
            // Act
            var result = await sut.AddVehicleToCustomer("EF02VCC", Guid.NewGuid(), Guid.NewGuid());

            // Assert
            Assert.True(result.MotData.MOTResults.FirstOrDefault().Comments.Count > 0);
        }
        public async Task AddVehicleToCustomer_Should_HaveLastUpdated()
        {
            // Arrange
            var sut = new CustomerVehicleService(repo, new MockVehicleDataService());
            // Act
            var result = await sut.AddVehicleToCustomer("EF02VCC", Guid.NewGuid(), Guid.NewGuid());

            // Assert
            Assert.IsType <DateTime>(result.LastUpdated);
            Assert.True(result.LastUpdated > DateTime.MinValue);
        }
        public async Task AddVehicleToCustomer_Should_HaveInitializedMotResults()
        {
            // Arrange
            var sut = new CustomerVehicleService(repo, new MockVehicleDataService());
            // Act
            var result = await sut.AddVehicleToCustomer("EF02VCC", Guid.NewGuid(), Guid.NewGuid());

            // Assert
            Assert.IsType <List <MotResult> >(result.MotData.MOTResults);
            Assert.NotNull(result.MotData.MOTResults);
        }
        public async Task AddVehicleToCustomer_Should_HaveBasicVehicleInfo()
        {
            // Arrange
            var sut = new CustomerVehicleService(repo, new MockVehicleDataService());
            // Act
            var result = await sut.AddVehicleToCustomer("EF02VCC", Guid.NewGuid(), Guid.NewGuid());

            // Assert
            Assert.Equal("RENAULT", result.Make.ToUpper());
            Assert.Equal("CLIO", result.Model.ToUpper());
            Assert.Equal("WHITE", result.Colour.ToUpper());
            Assert.Equal("PETROL", result.FuelType.ToUpper());
            Assert.Equal("EF02VCC", result.Registration.ToUpper());
        }
        public async Task AddVehicleToCustomer_Should_HaveOneVehicle()
        {
            // Arrange
            var clientId   = Guid.NewGuid();
            var customerId = Guid.NewGuid();
            var sut        = new CustomerVehicleService(repo, new MockVehicleDataService());
            // Act
            var addResult = await sut.AddVehicleToCustomer("EF02VCC", customerId, clientId);

            // Assert
            var result = await repo.FindAll(clientId);

            Assert.True(result.Count == 1);
        }
        public async Task UpdateServiceData_Should_ReturnCustomerVehicle()
        {
            // Arrange
            var sut     = new CustomerVehicleService(repo, new MockVehicleDataService());
            var vehicle = await sut.AddVehicleToCustomer("EF02VCC", Guid.NewGuid(), Guid.NewGuid());

            var serviceData = new ServiceData
            {
                EstAnualMileage         = 8000,
                MaxMileage              = 6000,
                MaxMonths               = 12,
                ServiceDataConfiguredBy = "Customer"
            };
            // Act
            var result = await sut.UpdateServiceData(serviceData, vehicle.Id, vehicle.ClientId);

            // Assert
            Assert.IsType <CustomerVehicle>(result);
            Assert.NotNull(result);
        }
        public async Task UpdateServiceData_Should_ReturnWithMatchingServiceData()
        {
            // Arrange
            var sut     = new CustomerVehicleService(repo, new MockVehicleDataService());
            var vehicle = await sut.AddVehicleToCustomer("EF02VCC", Guid.NewGuid(), Guid.NewGuid());

            var serviceData = new ServiceData
            {
                EstAnualMileage         = 8000,
                MaxMileage              = 6000,
                MaxMonths               = 12,
                ServiceDataConfiguredBy = "Customer"
            };
            // Act
            var result = await sut.UpdateServiceData(serviceData, vehicle.Id, vehicle.ClientId);

            // Assert
            Assert.Equal(serviceData.EstAnualMileage, result.ServiceData.EstAnualMileage);
            Assert.Equal(serviceData.MaxMonths, result.ServiceData.MaxMonths);
            Assert.Equal(serviceData.MaxMileage, result.ServiceData.MaxMileage);
            Assert.Equal(serviceData.ServiceDataConfiguredBy, result.ServiceData.ServiceDataConfiguredBy);
        }