Ejemplo n.º 1
0
        public void GetCustomersTest()
        {
            Technician technician = new Technician(); 
            technician.TechnicianID = 1;
            technician.Person = new Person()
            {
                Email = "*****@*****.**",
                Firstname = "PersonVorname",
                Lastname = "PersonNachname",
                Password = "******",
                Username = "******"
            };

            Customer cus = new Customer()
                {
                    Person = new Person()
                        {
                            Email = "*****@*****.**",
                            Firstname = "PersonVorname",
                            Lastname = "PersonNachname",
                            Password = "******",
                            Username = "******"
                        }
                };
            technician.Customers.Add(cus);

            CustomerService target = new CustomerService();

            List<Customer> expected = new List<Customer>(technician.Customers) ; 
            List<Customer> actual;
            actual = target.GetCustomers(technician);
            Assert.AreEqual(expected[0], actual[0]);
            
        }
Ejemplo n.º 2
0
 public Customer AddCustomer(string firstname, string email, string lastname, 
     string password, string username, Technician technician)
 {
     IUnityContainer unitycontainer = new UnityContainer();
     unitycontainer.LoadConfiguration("UnityContainer");
     SKS.Scada.BL.ICustomerService custserv = unitycontainer.Resolve<SKS.Scada.BL.ICustomerService>();
     return custserv.AddCustomer(firstname, email, lastname,
      password, username, technician);
 }
Ejemplo n.º 3
0
 public List<Customer> GetCustomers(Technician technician)
 {
     ValidatorFactory valFactory
        = EnterpriseLibraryContainer.Current.GetInstance<ValidatorFactory>();
     Validator<Technician> validator = valFactory.CreateValidator<Technician>();
     ValidationResults valResults = validator.Validate(technician);
     if (!valResults.IsValid)
     {
         logger_.Error("Validation Error");
         throw new ValidationException();
     }
     logger_.Info("Returned Customer from technician");
     return technician.Customers.ToList();
 }
Ejemplo n.º 4
0
 public Customer AddCustomer(string firstname, string email, string lastname, string password, string username, Technician technician)
 {
     Customer customer = new Customer();
     customer.Person = new Person()
     {
         Firstname = firstname,
         Email = email,
         Lastname = lastname,
         Password = password,
         Username = username
     };
     customer.Technician = technician;
     customer = repocustomer_.Add(customer);
     repocustomer_.CommitChanges();
     return customer;
 }