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(); }
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); }
public void TestCaseSetup() { _groupUser = new GroupUser { GroupId = "00000000-0000-0000-0000-000000000001", UserId = "2" }; _groupUserDB = new GroupUserDB { GroupId = "00000000-0000-0000-0000-000000000001", RightToCreateBoards = true, UserId = "2", IsConfirmed = false }; _groupDB = new GroupDB { Id = "00000000-0000-0000-0000-000000000001", AdminId = "2", Information = "Some product", Name = "Best", Created = DateTime.UtcNow, Deleted = null, IsNotDeleted = true, Modified = DateTime.UtcNow, GroupBoards = null, GroupUsers = null }; _groupRepositoryMock = new Mock <IGroupRepository>(); var config = new MapperConfiguration(cfg => { cfg.AddProfile(new GroupProfile()); cfg.AddProfile(new GroupBoardProfile()); cfg.AddProfile(new GroupProductProfile()); cfg.AddProfile(new GroupUserProfile()); cfg.AddProfile(new GroupCommentProfile()); }); _mapper = (new Mapper(config)).DefaultContext.Mapper; _groupUserService = new GroupUserService(_groupRepositoryMock.Object, _mapper); _selectedUserList = new List <GroupUserDB>(); _selectedList = new List <GroupDB>(); }