Ejemplo n.º 1
0
        public LoginModel(ApplicationGlobalModel applicationGlobalModel, UserNameClientCredentials userCredentials,
                          IAuthorisationRemoteService authorisationService, IRegionManager regionManager, IEventAggregator eventAggregator)
        {
            this.applicationGlobalModel = applicationGlobalModel;
            this.regionManager          = regionManager;
            this.userCredentials        = userCredentials;
            this.authorisationService   = authorisationService;
            this._eventAggregator       = eventAggregator;

            LoginCommand  = new AwaitableDelegateCommand(Login);
            LoadedCommand = new AwaitableDelegateCommand(Loaded);

            scheduler = TaskScheduler.FromCurrentSynchronizationContext();

            LoadPreviousSettings();
        }
        public async System.Threading.Tasks.Task InitializeKernelAsync()
        {
            kernel = new StandardKernel();
            kernel.Load(new ServiceConsumerNinjectModule());
            Mock <IServiceRunningIndicator> servMock = new Mock <IServiceRunningIndicator>();

            kernel.Bind <IServiceRunningIndicator>().ToConstant(servMock.Object);


            service              = kernel.Get <IAdministrationRemoteService>();
            pinzService          = kernel.Get <IPinzAdminRemoteService>();
            taskService          = kernel.Get <ITaskRemoteService>();
            authorisationService = kernel.Get <IAuthorisationRemoteService>();

            UserNameClientCredentials credentials = kernel.Get <UserNameClientCredentials>();

            credentials.UserName = TestUserCredentials.UserName;
            credentials.Password = TestUserCredentials.Password;
            credentials.UpdateCredentialsForAllFactories();

            company = new Company()
            {
                Name = "Pinz Online"
            };
            company = await pinzService.CreateCompanyAsync(company);

            Project project = new Project()
            {
                CompanyId   = company.CompanyId,
                Name        = "My test project",
                Description = "Descirption"
            };
            await service.CreateProjectAsync(project);

            User user = new User()
            {
                EMail          = "*****@*****.**",
                IsCompanyAdmin = true,
                CompanyId      = company.CompanyId
            };

            user = await service.CreateUserAsync(user);

            await service.AddUserToProjectAsync(user, project, true);

            category = await taskService.CreateCategoryInProjectAsync(project);
        }