Exemplo n.º 1
0
        public void BeforeEach()
        {
            IServiceCollection serviceCollection = ServiceConfiguration.InitServiceCollection();
            IServiceProvider   serviceProvider   = ServiceConfiguration.BuildServiceProvider();

            Configuration = serviceProvider.GetRequiredService <IConfiguration>();


            controller           = serviceProvider.GetRequiredService <ConnectionController>();
            accountRepository    = serviceProvider.GetRequiredService <IRepository <User, string> >();
            connectionRepository = serviceProvider.GetRequiredService <IRepository <Connection, long> >();
            IPasswordHasher <User> passwordHasher = serviceProvider.GetRequiredService <IPasswordHasher <User> >();

            account = new User
            {
                Username = "******",
                Email    = "*****@*****.**"
            };
            account.Password = passwordHasher.HashPassword(account, "password123");
            account          = accountRepository.Save(account);

            model = new LoginModel
            {
                Email    = "*****@*****.**",
                Password = "******",
                OS       = "Windows",
                Browser  = "Firefox"
            };
        }
        public void BeforeEach()
        {
            serviceCollection = ServiceConfiguration.InitServiceCollection();
            provider          = ServiceConfiguration.BuildServiceProvider();

            configuration        = provider.GetRequiredService <IConfiguration>();
            connectionRepository = provider.GetRequiredService <IRepository <Connection, long> >();
            userRepository       = provider.GetRequiredService <IRepository <User, string> >();


            validator = provider.GetRequiredService <AccessTokenValidator>();

            controller     = provider.GetRequiredService <ConnectionController>();
            userController = provider.GetRequiredService <UserController>();
        }
        public void BeforeEach()
        {
            IServiceCollection serviceCollection = ServiceConfiguration.InitServiceCollection();
            IServiceProvider   serviceProvider   = ServiceConfiguration.BuildServiceProvider();


            controller        = serviceProvider.GetRequiredService <UserController>();
            accountRepository = serviceProvider.GetRequiredService <IRepository <User, string> >();
            passwordHasher    = serviceProvider.GetRequiredService <IPasswordHasher <User> >();

            model = new AddUserModel
            {
                Email    = "*****@*****.**",
                Name     = "caleb",
                Surname  = "deGrace",
                Password = "******"
            };
        }
Exemplo n.º 4
0
        public void BeforeEach()
        {
            IServiceCollection serviceCollection = ServiceConfiguration.InitServiceCollection();
            IServiceProvider   serviceProvider   = ServiceConfiguration.BuildServiceProvider();

            Configuration = serviceProvider.GetRequiredService <IConfiguration>();

            controller           = serviceProvider.GetRequiredService <AuthorizationController>();
            connectionController = serviceProvider.GetRequiredService <ConnectionController>();
            accountController    = serviceProvider.GetRequiredService <AccountController>();

            connectionRepository    = serviceProvider.GetRequiredService <IRepository <Connection, long> >();
            authorizationRepository = serviceProvider.GetRequiredService <IRepository <Authorization, long> >();
            clientRepository        = serviceProvider.GetRequiredService <IRepository <Client, string> >();

            account = accountController.Create(new AddAccountModel
            {
                Name     = "Chendjou",
                Surname  = "Caleb",
                Email    = "*****@*****.**",
                Password = "******",
            });

            connection = connectionController.Create(new LoginModel
            {
                Email    = account.Email,
                Password = "******"
            });

            client = clientRepository.Save(new Client
            {
                Name       = "Identity Client",
                SecretCode = Guid.NewGuid().ToString()
            });


            model = new AuthorizeModel
            {
                ClientId     = client.Id,
                SecretCode   = client.SecretCode,
                ConnectionId = connection.Id
            };
        }
Exemplo n.º 5
0
        public void BeforeEach()
        {
            serviceCollection = ServiceConfiguration.InitServiceCollection();
            provider          = ServiceConfiguration.BuildServiceProvider();

            configuration           = provider.GetRequiredService <IConfiguration>();
            clientRepository        = provider.GetRequiredService <IRepository <Client, string> >();
            authorizationRepository = provider.GetRequiredService <IRepository <Authorization, long> >();
            connectionRepository    = provider.GetRequiredService <IRepository <Connection, long> >();
            accountRepository       = provider.GetRequiredService <IRepository <Account, string> >();


            validator = provider.GetRequiredService <AccessTokenValidator>();

            controller = provider.GetRequiredService <AuthorizationController>();

            client = clientRepository.Save(new Client {
                Name = "clientApp", Id = "d8g1fn"
            });
        }
        public void BeforeEach()
        {
            IServiceCollection serviceCollection = ServiceConfiguration.InitServiceCollection();
            IServiceProvider   serviceProvider   = ServiceConfiguration.BuildServiceProvider();


            controller         = serviceProvider.GetRequiredService <RoleController>();
            userRepository     = serviceProvider.GetRequiredService <IRepository <User, string> >();
            roleRepository     = serviceProvider.GetRequiredService <IRepository <Role, string> >();
            userRoleRepository = serviceProvider.GetRequiredService <IRepository <UserRole, long> >();

            var model = new AddUserModel
            {
                Email    = "*****@*****.**",
                Name     = "caleb",
                Surname  = "deGrace",
                Password = "******"
            };
            var userController = serviceProvider.GetRequiredService <UserController>();

            user = userController.Create(model);
        }
Exemplo n.º 7
0
 public App()
 {
     serviceProvider = ServiceConfiguration.BuildServiceProvider();
 }