Ejemplo n.º 1
0
        public async Task Setup()
        {
            context = await TestDatabase.GetDatabaseContext();

            MockAppsRepository      = new MockAppsRepository(context);
            MockUsersRepository     = new MockUsersRepository(context);
            MockAppAdminsRepository = new MockAppAdminsRepository(context);
            MockRolesRepository     = new MockRolesRepository(context);

            sut = new AppsService(
                MockAppsRepository.AppsRepositorySuccessfulRequest.Object,
                MockUsersRepository.UsersRepositorySuccessfulRequest.Object,
                MockAppAdminsRepository.AppAdminsRepositorySuccessfulRequest.Object,
                MockRolesRepository.RolesRepositorySuccessfulRequest.Object);

            sutAppRepoFailure = new AppsService(
                MockAppsRepository.AppsRepositoryFailedRequest.Object,
                MockUsersRepository.UsersRepositorySuccessfulRequest.Object,
                MockAppAdminsRepository.AppAdminsRepositoryFailedRequest.Object,
                MockRolesRepository.RolesRepositoryFailedRequest.Object);

            sutUserRepoFailure = new AppsService(
                MockAppsRepository.AppsRepositorySuccessfulRequest.Object,
                MockUsersRepository.UsersRepositoryFailedRequest.Object,
                MockAppAdminsRepository.AppAdminsRepositoryFailedRequest.Object,
                MockRolesRepository.RolesRepositorySuccessfulRequest.Object);

            sutPromoteUser = new AppsService(
                MockAppsRepository.AppsRepositorySuccessfulRequest.Object,
                MockUsersRepository.UsersRepositoryInitiatePasswordSuccessful.Object,
                MockAppAdminsRepository.AppAdminsRepositoryPromoteUser.Object,
                MockRolesRepository.RolesRepositorySuccessfulRequest.Object);;

            dateCreated = DateTime.UtcNow;
            license     = TestObjects.GetLicense();
            baseRequest = TestObjects.GetBaseRequest();
            paginator   = TestObjects.GetPaginator();
            userId      = 1;
            appId       = 1;
        }
        public async Task Setup()
        {
            userName = "******";
            password = "******";

            context = await TestDatabase.GetDatabaseContext();

            MockUsersRepository     = new MockUsersRepository(context);
            MockRolesRepository     = new MockRolesRepository(context);
            MockAppsRepository      = new MockAppsRepository(context);
            MockAppAdminsRepository = new MockAppAdminsRepository(context);

            MockUserManagementService = new MockUserManagementService();

            tokenManagement = new TokenManagement()
            {
                Secret   = "3c1ad157-be37-40d2-9cc8-e7527a56aa7b",
                Issuer   = "testProject",
                Audience = "testEnvironment"
            };

            IOptions <TokenManagement> options = Options.Create <TokenManagement>(tokenManagement);

            sutValid = new AuthenticateService(
                MockUsersRepository.UsersRepositorySuccessfulRequest.Object,
                MockRolesRepository.RolesRepositorySuccessfulRequest.Object,
                MockAppsRepository.AppsRepositorySuccessfulRequest.Object,
                MockAppAdminsRepository.AppAdminsRepositorySuccessfulRequest.Object,
                MockUserManagementService.UserManagementServiceSuccssfulRequest.Object,
                options);
            sutInvalid = new AuthenticateService(
                MockUsersRepository.UsersRepositoryFailedRequest.Object,
                MockRolesRepository.RolesRepositoryFailedRequest.Object,
                MockAppsRepository.AppsRepositoryFailedRequest.Object,
                MockAppAdminsRepository.AppAdminsRepositoryFailedRequest.Object,
                MockUserManagementService.UserManagementServiceFailedRequest.Object,
                options);
        }
        public async Task Setup()
        {
            context = await TestDatabase.GetDatabaseContext();

            MockEmailService                 = new MockEmailService();
            MockUsersRepository              = new MockUsersRepository(context);
            MockAppsRepository               = new MockAppsRepository(context);
            MockRolesRepository              = new MockRolesRepository(context);
            MockAppAdminsRepository          = new MockAppAdminsRepository(context);
            MockEmailConfirmationsRepository = new MockEmailConfirmationsRepository(context);
            MockPasswordResetRepository      = new MockPasswordResetsRepository(context);

            sut = new UsersService(
                MockUsersRepository.UsersRepositorySuccessfulRequest.Object,
                MockAppsRepository.AppsRepositorySuccessfulRequest.Object,
                MockRolesRepository.RolesRepositorySuccessfulRequest.Object,
                MockAppAdminsRepository.AppAdminsRepositorySuccessfulRequest.Object,
                MockEmailConfirmationsRepository.EmailConfirmationsRepositorySuccessfulRequest.Object,
                MockPasswordResetRepository.PasswordResetsRepositorySuccessfulRequest.Object,
                MockEmailService.EmailServiceSuccessfulRequest.Object);

            sutFailure = new UsersService(
                MockUsersRepository.UsersRepositoryFailedRequest.Object,
                MockAppsRepository.AppsRepositorySuccessfulRequest.Object,
                MockRolesRepository.RolesRepositorySuccessfulRequest.Object,
                MockAppAdminsRepository.AppAdminsRepositoryFailedRequest.Object,
                MockEmailConfirmationsRepository.EmailConfirmationsRepositoryFailedRequest.Object,
                MockPasswordResetRepository.PasswordResetsRepositorySuccessfulRequest.Object,
                MockEmailService.EmailServiceSuccessfulRequest.Object);

            sutEmailFailure = new UsersService(
                MockUsersRepository.UsersRepositoryEmailFailedRequest.Object,
                MockAppsRepository.AppsRepositorySuccessfulRequest.Object,
                MockRolesRepository.RolesRepositorySuccessfulRequest.Object,
                MockAppAdminsRepository.AppAdminsRepositoryFailedRequest.Object,
                MockEmailConfirmationsRepository.EmailConfirmationsRepositoryFailedRequest.Object,
                MockPasswordResetRepository.PasswordResetsRepositorySuccessfulRequest.Object,
                MockEmailService.EmailServiceSuccessfulRequest.Object);

            sutResetPassword = new UsersService(
                MockUsersRepository.UsersRepositoryInitiatePasswordSuccessful.Object,
                MockAppsRepository.AppsRepositoryInitiatePasswordSuccessfulRequest.Object,
                MockRolesRepository.RolesRepositorySuccessfulRequest.Object,
                MockAppAdminsRepository.AppAdminsRepositorySuccessfulRequest.Object,
                MockEmailConfirmationsRepository.EmailConfirmationsRepositorySuccessfulRequest.Object,
                MockPasswordResetRepository.PasswordResetsRepositorySuccessfulRequest.Object,
                MockEmailService.EmailServiceSuccessfulRequest.Object);

            sutResendEmailConfirmation = new UsersService(
                MockUsersRepository.UsersRepositoryResendEmailConfirmationSuccessful.Object,
                MockAppsRepository.AppsRepositorySuccessfulRequest.Object,
                MockRolesRepository.RolesRepositorySuccessfulRequest.Object,
                MockAppAdminsRepository.AppAdminsRepositorySuccessfulRequest.Object,
                MockEmailConfirmationsRepository.EmailConfirmationsRepositorySuccessfulRequest.Object,
                MockPasswordResetRepository.PasswordResetsRepositorySuccessfulRequest.Object,
                MockEmailService.EmailServiceSuccessfulRequest.Object);

            sutRequestPasswordReset = new UsersService(
                MockUsersRepository.UsersRepositorySuccessfulRequest.Object,
                MockAppsRepository.AppsRepositorySuccessfulRequest.Object,
                MockRolesRepository.RolesRepositorySuccessfulRequest.Object,
                MockAppAdminsRepository.AppAdminsRepositorySuccessfulRequest.Object,
                MockEmailConfirmationsRepository.EmailConfirmationsRepositorySuccessfulRequest.Object,
                MockPasswordResetRepository.PasswordResetsRepositorySuccessfullCreateRequest.Object,
                MockEmailService.EmailServiceSuccessfulRequest.Object);

            baseRequest = TestObjects.GetBaseRequest();
        }