Пример #1
0
    private void Handle(MaintenanceJobPlanned e)
    {
        MaintenanceJob job             = new MaintenanceJob(e.JobId);
        Customer       customer        = new Customer(e.CustomerInfo.Id, e.CustomerInfo.Name, e.CustomerInfo.TelephoneNumber);
        LicenseNumber  licenseNumber   = LicenseNumber.Create(e.VehicleInfo.LicenseNumber);
        Vehicle        vehicle         = new Vehicle(licenseNumber, e.VehicleInfo.Brand, e.VehicleInfo.Type, customer.Id);
        Timeslot       plannedTimeslot = Timeslot.Create(e.StartTime, e.EndTime);

        job.Plan(plannedTimeslot, vehicle, customer, e.Description);
        Jobs.Add(job);
    }
Пример #2
0
    public void Creating_A_LicenseNumber_With_An_Invalid_Format_Should_Throw_Exception()
    {
        // arrange
        string licenseNumber = "123456";

        // act
        var thrownException =
            Assert.Throws <InvalidValueException>(() => LicenseNumber.Create(licenseNumber));

        // assert
        Assert.Equal($"The specified license-number '{licenseNumber}' is not in the correct format.",
                     thrownException.Message);
    }
Пример #3
0
 private void saveLicenseNumber(string ln, string emailAddress)
 {
     using (var db = new DamoclesEntities())
     {
         var lnumber    = db.LicenseNumbers;
         var newlicense = new LicenseNumber();
         newlicense.emailAddress   = emailAddress;
         newlicense.LicenseNumber1 = ln;
         lnumber.Add(newlicense);
         db.SaveChanges();
         if (LogEvent != null)
         {
             LogEvent("Saved License Number");
         }
     }
 }
Пример #4
0
        public override string ToString()
        {
            string BikeInfo = string.Format(
                @"
Your bike info:
-----------------
Bike license type is: {0}
Bike engine volume is: {1}
Bike number of wheels is: {2}

Wheels status is:
----------------- 
Current PSI: {3}
Manufacturer Name: {4}",

                LicenseNumber.ToString(),
                EngineVolume.ToString(),
                WheelsOfVehicle.Length.ToString(),
                WheelsOfVehicle[0].CurrentPSI.ToString(),
                WheelsOfVehicle[0].ManufecturerName.ToString());


            return(BikeInfo);
        }
Пример #5
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 10, Configuration.FieldSeparator),
                       Id,
                       PrimaryKeyValueLoc?.ToDelimitedString(),
                       LocationDescription,
                       LocationTypeLoc != null ? string.Join(Configuration.FieldRepeatSeparator, LocationTypeLoc.Select(x => x.ToDelimitedString())) : null,
                       OrganizationNameLoc != null ? string.Join(Configuration.FieldRepeatSeparator, OrganizationNameLoc.Select(x => x.ToDelimitedString())) : null,
                       LocationAddress != null ? string.Join(Configuration.FieldRepeatSeparator, LocationAddress.Select(x => x.ToDelimitedString())) : null,
                       LocationPhone != null ? string.Join(Configuration.FieldRepeatSeparator, LocationPhone.Select(x => x.ToDelimitedString())) : null,
                       LicenseNumber != null ? string.Join(Configuration.FieldRepeatSeparator, LicenseNumber.Select(x => x.ToDelimitedString())) : null,
                       LocationEquipment != null ? string.Join(Configuration.FieldRepeatSeparator, LocationEquipment.Select(x => x.ToDelimitedString())) : null,
                       LocationServiceCode?.ToDelimitedString()
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
Пример #6
0
 private void SetDefaults()
 {
     LicenseNumber = LicenseNumber.Create(TestDataGenerators.GenerateRandomLicenseNumber());
     Brand         = "Volkswagen";
     Type          = "Tiguan";
 }
Пример #7
0
 public VehicleBuilder WithRandomLicenseNumber()
 {
     LicenseNumber = LicenseNumber.Create(TestDataGenerators.GenerateRandomLicenseNumber());
     return(this);
 }
Пример #8
0
 public VehicleBuilder WithLicenseNumber(string licenseNumber)
 {
     LicenseNumber = LicenseNumber.Create(licenseNumber);
     return(this);
 }
Пример #9
0
 public override int GetHashCode()
 {
     return(LicenseNumber.GetHashCode());
 }
Пример #10
0
 public string GetLicenseNumber()
 {
     return($"***{LicenseNumber.ToUpper()}***");
 }
Пример #11
0
 public Vehicle(LicenseNumber licenseNumber, string brand, string type, string ownerId) : base(licenseNumber)
 {
     Brand   = brand;
     Type    = type;
     OwnerId = ownerId;
 }