Ejemplo n.º 1
0
        /// <summary>
        /// Log in using valid account
        /// </summary>
        public void LogInAsRegisteredUser()
        {
            // Clear last user logged in
            UserGenerator.Initialize();

            //Log in using the user credential, set in Constants.cs file
            LogIn(UserGenerator.Generate(true));
        }
Ejemplo n.º 2
0
        public void AddStudentsToGroupTest()
        {
            UserGenerator.Generate(this.tests.Storage, this.demoStorage);

            foreach (var user in this.demoStorage.GetStudents())
            {
                Assert.AreEqual(1, this.tests.Storage.GetUsersInGroup(this.tests.Storage.GetGroups().SingleOrDefault(g => g.Name == "Демонстраційна група")).Where(u => u.Username == user.Username).Count());
            }
        }
Ejemplo n.º 3
0
        public void RegisterNewUser()
        {
            User user = UserGenerator.Generate();

            this.emailAddressTextField.SendKeys(user.EmailAddress);
            this.passwordTextField.SendKeys(user.Password);
            this.confirmPasswordTextField.SendKeys(user.Password);

            this.registerButton.Click();
        }
Ejemplo n.º 4
0
        public void CreateGroupTest()
        {
            Assert.AreEqual(0, this.tests.Storage.GetGroups().Where(g => g.Name == "Демонстраційна група").Count());

            UserGenerator.Generate(this.tests.Storage, this.demoStorage);

            Assert.AreEqual(1, this.tests.Storage.GetGroups().Where(g => g.Name == "Демонстраційна група").Count());

            UserGenerator.Generate(this.tests.Storage, this.demoStorage);

            Assert.AreEqual(1, this.tests.Storage.GetGroups().Where(g => g.Name == "Демонстраційна група").Count());
        }
        public void RegisterNewUser()
        {
            ClearAllRegirsterUserFormFields();

            var user = UserGenerator.Generate();

            emailAddressField.SendKeys(user.EmailAddress);
            passwordField.SendKeys(user.Password);
            confirmPasswordField.SendKeys(user.Password);

            registerButton.Click();
        }
Ejemplo n.º 6
0
        public void RegisterNewUser()
        {
            var User = UserGenerator.Generate();

            firstNameTextField.SendKeys(User.FirstName);

            lastNameTextField.SendKeys(User.LastName);
            phoneTextField.SendKeys(User.PhoneNumber);
            emailAddressTextField.SendKeys(User.EmailAddress);
            passwordTextField.SendKeys(User.Password);
            confirmPasswordTextField.SendKeys(User.Password);

            registerButton.Click();
        }
Ejemplo n.º 7
0
        public void CreateTeachersTest()
        {
            foreach (var teacher in this.demoStorage.GetTeachers())
            {
                Assert.IsNull(this.tests.Storage.GetUser(teacher.Username));
            }

            UserGenerator.Generate(this.tests.Storage, this.demoStorage);
            foreach (var teacher in this.demoStorage.GetTeachers())
            {
                Assert.AreEqual(1, this.tests.Storage.GetUsersInRole(Common.Models.Role.Teacher).Count(u => u.Username == teacher.Username));
            }

            UserGenerator.Generate(this.tests.Storage, this.demoStorage);
            foreach (var user in this.demoStorage.GetTeachers())
            {
                Assert.AreEqual(1, this.tests.Storage.GetUsers(u => u.Username == user.Username).Count());
            }
        }
Ejemplo n.º 8
0
        public void CreateAdministratorsTest()
        {
            foreach (var admin in this.demoStorage.GetAdministrators())
            {
                Assert.IsNull(this.tests.Storage.GetUser(admin.Username));
            }

            UserGenerator.Generate(this.tests.Storage, this.demoStorage);
            foreach (var admin in this.demoStorage.GetAdministrators())
            {
                Assert.AreEqual(1, this.tests.Storage.GetUsersInRole(Common.Models.Role.Admin).Count(u => u.Username == admin.Username));
            }

            UserGenerator.Generate(this.tests.Storage, this.demoStorage);
            foreach (var user in this.demoStorage.GetAdministrators())
            {
                Assert.AreEqual(1, this.tests.Storage.GetUsers(u => u.Username == user.Username).Count());
            }
        }
Ejemplo n.º 9
0
        public void Update(string evt, params object[] data)
        {
            switch (evt)
            {
            case LMSNotifications.ApplicationStart:
                var cacheProvider     = container.Resolve <ICacheProvider>();
                var userStorage       = new FakeDatabaseUserStorage(container.Resolve <ILmsService>(), "lex");
                var cachedUserStorage = new CachedUserStorage(userStorage, cacheProvider);
                var demoStorage       = container.Resolve <IDemoStorage>();

                UserGenerator.Generate(cachedUserStorage, demoStorage);

                this.GeneratePascal();

                this.GenerateForTestingSystemSeleniumTests();

                this.GenerateForSeleniumTests();
                break;
            }
        }
Ejemplo n.º 10
0
        static async Task Main(string[] args)
        {
            if (File.Exists(WorldSettings.FileName))
            {
                File.Delete(WorldSettings.FileName);
            }

            //moment t0
            var t0Models = CarModelGenerator.Generate(WorldSettings.ModelCount, Settings.FirstDataCollection.Year - 3)
                           .ToList();

            var t0CarBatches = t0Models
                               .Select(m => m.CreateBatch(Settings.Random.Next(WorldSettings.CarBatchSizeRange.min, WorldSettings.CarBatchSizeRange.max)));

            var t0Cars = t0CarBatches
                         .SelectMany(modelGroup => modelGroup.Select(car => car))
                         .ToArray();

            var t0RentRates = RentRateGenerator.Generate(WorldSettings.RentRateCount).ToList();

            // save to files
            SaveAsScripts(t0Cars, null, t0Models, null, t0RentRates, OperationAreaStub.AreasOfOperation);


            //transmission from t0 to t1
            var t1CarBatches     = t0Models.Select(m => m.CreateBatch(Settings.Random.Next(WorldSettings.CarBatchSizeRange.min, WorldSettings.CarBatchSizeRange.max)));
            var t1AdditionalCars = t1CarBatches.SelectMany(modelGroup => modelGroup.Select(c => c));

            var t1Cars = t0Cars.Concat(t1AdditionalCars).ToList();

            var t1Users = UserGenerator.Generate(2000).Distinct().ToList();

            var t1Licenses = t1Users.Select(u => u.GenerateForUser());

            Console.WriteLine("Creating rents");
            var sw = Stopwatch.StartNew();

            var t1Rentals = await RentGenerator.Generate(t1Cars, t1Users, t0RentRates, Settings.SystemStartDate, Settings.FirstDataCollection, 20000);

            t1Cars.ForEach(c =>
            {
                c.GenerateServiceData(t1Rentals,
                                      c.DataZakupu,
                                      Settings.FirstDataCollection,
                                      Settings.FirstDataCollection);
            });

            // saving to files
            SaveAsJson(t1Cars.Select(c => c.Services).SelectMany(s => s).ToArray(), "t1");
            SaveAsScripts(t1AdditionalCars, t1Users, null, t1Rentals, null, null, t1Licenses, "t1");

            // delete all the service action infromation about t1 cars
            t1Cars.ForEach(c => c.Services = new List <ServiceDataModel>());

            // transmission from t0 to t1
            var t2CarBatches = t0Models.Select(m => m.CreateBatch(Settings.Random.Next(WorldSettings.CarBatchSizeRange.min, WorldSettings.CarBatchSizeRange.max)));

            var t2AdditionalCars  = t2CarBatches.SelectMany(modelGroup => modelGroup.Select(c => c));
            var t2AdditionalUsers = UserGenerator.Generate(2000).Distinct().ToArray();

            var t2Cars  = t1Cars.Concat(t2AdditionalCars).ToArray();
            var t2Users = t1Users.Concat(t2AdditionalUsers).Distinct().ToArray();

            sw.Restart();

            var t2Rentals = await RentGenerator.Generate(t2Cars, t2Users, t0RentRates, Settings.FirstDataCollection,
                                                         Settings.SecondDataCollection, 30000);

            Console.WriteLine($"Rent T2 generation took {sw.Elapsed.Seconds} seconds");

            sw.Restart();
            t2Cars.ToList().ForEach(c =>
            {
                c.GenerateServiceData(t2Rentals,
                                      Settings.FirstDataCollection,
                                      Settings.SecondDataCollection,
                                      Settings.SecondDataCollection);
            });
            Console.WriteLine($"Service T2 data generation took {sw.Elapsed.Seconds} seconds");


            SaveAsJson(t2Cars.Select(c => c.Services).SelectMany(s => s).ToArray(), "t2");
            SaveAsScripts(t2AdditionalCars, t2AdditionalUsers, null, t2Rentals, null, null, null, "t2");


            Console.WriteLine("finished");
        }
Ejemplo n.º 11
0
 /// <summary>
 ///
 /// </summary>
 public void LogInAsNewUser()
 {
     UserGenerator.Initialize();
     LogIn(UserGenerator.Generate(false));
 }