Ejemplo n.º 1
0
        public async void Pass_As__A_Valid_SW_Name_Due_Diff_In_Cases_And_Not_Complete_Name(string userInput)
        {
            bool isValidated = await CustomerValidator.NameValidator(userInput);

            Assert.True(isValidated, "The name given should pass as a valid nam,e despite minor difference in capitaliaztion");
        }
Ejemplo n.º 2
0
        public async void Reject_As__A_Valid_SW_Name(string userInput)
        {
            bool isValidated = await CustomerValidator.NameValidator(userInput);

            Assert.False(isValidated, "The name given should NOT PASS  as a valid nam, because they are completly wrong or not complete");
        }
Ejemplo n.º 3
0
        public async void Pass_As__A_Valid_SW_Name()
        {
            bool isValidated = await CustomerValidator.NameValidator("Luke Skywalker");

            Assert.True(isValidated, "The name Luke Skywalker should pass as a valid name");
        }
Ejemplo n.º 4
0
 public async void Reject_As_A_Valid_StarWars_Names(string userInputName)
 {
     Assert.False(await CustomerValidator.NameValidator(userInputName));
 }
Ejemplo n.º 5
0
 public async void Pass_Incomplete_And_Not_Case_Sensitive_Names(string userInputName)
 {
     Assert.True(await CustomerValidator.NameValidator(userInputName));
 }
Ejemplo n.º 6
0
 public async void Pass_As_A_Valid_StarWars_Name()
 {
     Assert.True(await CustomerValidator.NameValidator("Luke Skywalker"));
 }
Ejemplo n.º 7
0
        }                                     // Vara eller icke vara?

        // Navigation Properties -
        //public List<ParkingOrder> ParkingOrders { get; set; }

        // Navigation Properties - Här vet vi att en specifik kund kan ha deltagit i flera olika parkeringar
        //public List<ParkingOrder> ParkingOrders { get; set; }


        public async Task <IFluentCustomer> SelfRegistration()
        {
            this.InvoicePaid = false; // Default värde

            Console.WriteLine($"Välkommen till rymdparkeringshuset {_parkingHouse.Name}!");
            Console.WriteLine("=========================================================================================\n");
            Console.WriteLine($"Just nu har vi {ParkingHouse.AmountOfEmptylots} av totalt {ParkingHouse.TotalParkingsLots} platser.\n");
            Console.WriteLine("Var vänlig och registrera ditt namn och rymdskeppet du önskar parkera.\n");

            string inputName = string.Empty;
            bool   validated = false;

            while (validated == false)
            {
                Console.WriteLine("Skriv in ditt namn: ");
                inputName = Console.ReadLine();

                validated = await CustomerValidator.NameValidator(inputName);

                string message;
                message = (validated) ? "Valid name" : "Invalid name";
                Console.WriteLine($"Valt namn: { CustomerValidator.RegisteredName}");

                Console.WriteLine();
                Console.WriteLine(message);
                Console.WriteLine();
            }

            this.Name = CustomerValidator.RegisteredName;


            var customerOut = new Customer();

            customerOut = DbAccess.TryToGetExistingCustomer(this);

            if (customerOut.Email == null)
            {
                Console.Write("Skriv in din emailadress: ");
                this.Email = Console.ReadLine();
                DbAccess.RegistrateCustomerIntoDB(customerOut);
            }
            else
            {
                Console.WriteLine($"Kunden {customerOut.Name} existerar redan i registret");
            }


            var customerID = DbAccess.GetCustomerId(customerOut.Name);

            Console.WriteLine($"\nNamnvalidering godkänd. Du har KundId: {customerID}");
            this.ParkingRegistration.CustomerId = customerID;

            this.Starship = await RegistrateStarship();


            DbAccess.RegistrateStarshipIntoDB(Starship);
            this.ParkingRegistration.StarshipId = DbAccess.GetStarshipId(Starship.Name);

            Console.WriteLine($"Registreringen är nu slutförd för {Name} och skeppet som tilldelats ID-nummer: {Starship}.\n");
            Console.WriteLine();
            return(this);
        }