コード例 #1
0
        public async Task AddUserToGroupWithoutValidation_AfterAdded_Success()
        {
            GroupUserService groupUserService = new GroupUserService(
                IBaseDAOMock <GroupUserEntity> .Create().Add_Success().Object,
                IBaseDAOMock <RoleEntity> .Create().Object,
                IBaseDAOMock <AppUserEntity> .Create().Object,
                IBaseDAOMock <GroupEntity> .Create().Object,
                IGroupUserStoreMock.Create().Object,
                IAddGroupUserFilterMock.Create().BeforeAdd_Success().AfterAdded_Success().Object,
                IValidatorMock <AddExistingUserRequest> .Create().Object,
                NullLogger <GroupUserService> .Instance);

            Result <GroupUserEntity> result = await groupUserService.AddUserToGroupWithoutValidation("user_id", "group_id", "role_id");

            result.Success.Should().BeTrue();
        }
コード例 #2
0
        public async Task AddUserToGroupWithoutValidation_AfterAdded_Failure()
        {
            GroupUserService groupUserService = new GroupUserService(
                IBaseDAOMock <GroupUserEntity> .Create().Add_Success().Object,
                IBaseDAOMock <RoleEntity> .Create().Object,
                IBaseDAOMock <AppUserEntity> .Create().Object,
                IBaseDAOMock <GroupEntity> .Create().Object,
                IGroupUserStoreMock.Create().Object,
                IAddGroupUserFilterMock.Create().BeforeAdd_Success().AfterAdded_Failure().Object,
                IValidatorMock <AddExistingUserRequest> .Create().Object,
                NullLogger <GroupUserService> .Instance);

            Result <GroupUserEntity> result = await groupUserService.AddUserToGroupWithoutValidation("user_id", "group_id", "role_id");

            result.Success.Should().BeFalse();
            result.ResultMessages.Should().Contain(x => x.Code == TesttConstants.RESULT_ERROR_CODE);
        }
コード例 #3
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();
        }