Ejemplo n.º 1
0
        public async Task AddUser_AfterAdded_Success()
        {
            AddUserService addUserService = new AddUserService(
                UserManagerMock.Create().WithCreateSuccess().Object,
                SignInManagerMock.Create().Object,
                IEmailConfirmationServiceMock.Create().SendVerificationMailSuccess().Object,
                IGroupUserServiceMock.Create().Object,
                IAddUserFilterMock.Create().BeforeAdd_Success().AfterAdded_Success().Object,
                IBaseDAOMock<AppUserEntity>.Create().Object,
                IBaseDAOMock<InviteEntity>.Create().Object,
                IBaseDAOMock<RoleEntity>.Create().Object,
                IOptionsMock<IdentityUIEndpoints>.Create().DefaultValue().Object,
                IValidatorMock<NewUserRequest>.Create().Object,
                IValidatorMock<RegisterRequest>.Create().Object,
                IValidatorMock<AcceptInviteRequest>.Create().Object,
                IValidatorMock<ExternalLoginRegisterRequest>.Create().Object,
                IValidatorMock<GroupBaseUserRegisterRequest>.Create().Object,
                IValidatorMock<BaseRegisterRequest>.Create().Validate_Valid().Object,
                IValidatorMock<IUserAttributeRequest>.Create().Validate_Valid().Object,
                NullLogger<AddUserService>.Instance);

            BaseRegisterRequest baseRegisterRequest = new Fixture()
                .Build<BaseRegisterRequest>()
                .Create();

            Result<AppUserEntity> result = await addUserService.AddUser(baseRegisterRequest);

            result.Success.Should().BeTrue();
        }
Ejemplo n.º 2
0
        public async Task Add_AfterAdded_Success()
        {
            InviteService inviteService = new InviteService(
                IBaseDAOMock <AppUserEntity> .Create().Exists_Failure().Object,
                IBaseDAOMock <RoleEntity> .Create().Object,
                IBaseDAOMock <InviteEntity> .Create().Add_Success().Exists_Failure().Object,
                IGroupStoreMock.Create().Object,
                IGroupUserStoreMock.Create().Object,
                IEmailServiceMock.Create().SendInvite_Success().Object,
                IAddInviteFilterMock.Create().BeforeAdd_Success().AfterAdded_Success().Object,
                IValidatorMock <InviteToGroupRequest> .Create().Object,
                IValidatorMock <InviteRequest> .Create().Object,
                NullLogger <InviteService> .Instance,
                IOptionsMock <IdentityUIOptions> .Create().DefaultValue().Object,
                IOptionsMock <IdentityUIEndpoints> .Create().DefaultValue().Object);

            Result result = await inviteService.AddInvite("email");

            result.Success.Should().BeTrue();
        }