Example #1
0
 private Task Role_assignment_successful()
 {
     Assert.Equal(loginResult.BodyJson <LoginResponse>().User.Id, assignRoleResult.BodyJson <UserTeam>().UserId);
     Assert.Equal(createRoleResult.BodyJson <Role>().Id, assignRoleResult.BodyJson <UserTeam>().RoleId);
     Assert.Equal(createTeamResult.BodyJson <Team>().Id, assignRoleResult.BodyJson <UserTeam>().TeamId);
     return(Task.CompletedTask);
 }
Example #2
0
 private Task Adding_user_successful()
 {
     Assert.Equal(registerResult.BodyJson <User>().Id, addUserResult.BodyJson <UserTeam>().UserId);
     Assert.Equal(createRoleResult.BodyJson <Role>().Id, addUserResult.BodyJson <UserTeam>().RoleId);
     Assert.Equal(createTeamResult.BodyJson <Team>().Id, addUserResult.BodyJson <UserTeam>().TeamId);
     return(Task.CompletedTask);
 }
Example #3
0
        private async Task User_tries_to_create_new_channel_providing_channel_name()
        {
            var channel = DataGenerator.GenerateSingleChannel(config.Context, createTeamResult.BodyJson <Team>().Id);

            createChannelResult = await helper.CreateChannelResponse(channel,
                                                                     loginResult.BodyJson <LoginResponse>().User.Id,
                                                                     loginResult.BodyJson <LoginResponse>().Token);
        }
Example #4
0
 private async Task New_messages_were_sent()
 {
     foreach (var m in messages)
     {
         sendMessages2 = await helper.SendMessageResponse(m.MessageText, m.TargetId, m.SenderId,
                                                          sendMessages.BodyJson <Message>().ChannelId,
                                                          loginResult.Body.DeserializeJson <LoginResponse>().Token);
     }
 }
Example #5
0
        private Task Then_the_login_operation_should_be_unsuccessful()
        {
            Assert.Equal(HttpStatusCode.Unauthorized, result.StatusCode);
            var response = result.BodyJson <Msg>();

            Assert.Equal("Invalid credentials", response.Message);
            return(Task.CompletedTask);
        }
Example #6
0
        private Task Channel_creation_unsuccessful()
        {
            Assert.Equal(HttpStatusCode.BadRequest, createNewChannelResult.StatusCode);
            var response = createNewChannelResult.BodyJson <Msg>();

            Assert.Equal("Channel with that name already exists", response.Message);
            return(Task.CompletedTask);
        }
Example #7
0
        private Task Registration_is_unsusccessful_because_of_existing_email()
        {
            Assert.Equal(HttpStatusCode.BadRequest, result.StatusCode);
            var response = result.BodyJson <Msg>();

            Assert.Equal("Email already exists", response.Message);
            return(Task.CompletedTask);
        }
Example #8
0
        private async Task Users_wants_to_change_channel_name()
        {
            channel = DataGenerator.GenerateSingleChannel(config.Context, createTeamResult.BodyJson <Team>().Id);

            createNewChannelResult = await helper.CreateChannelResponse(channel,
                                                                        loginResult.Body.DeserializeJson <LoginResponse>().User.Id,
                                                                        loginResult.Body.DeserializeJson <LoginResponse>().Token);


            editChannelNameResult = await helper.EditChannelResponse(createNewChannelResult.BodyJson <Channel>().Id,
                                                                     "Developer", loginResult.Body.DeserializeJson <LoginResponse>().Token);
        }
Example #9
0
        private async Task Given_the_user_is_logged_in()
        {
            registerResult = await helper.RegisterResponse(user);

            loginResult = await helper.LoginResponse(user);

            Assert.Equal(HttpStatusCode.OK, loginResult.StatusCode);
            var body = loginResult.BodyJson <LoginResponse>();

            Assert.Equal(body.User.Username, user.Username);
            Assert.NotNull(body.Token);
            Assert.NotEmpty(body.Token);
        }
Example #10
0
        private async Task Given_the_user_creates_team_and_is_admin()
        {
            team = DataGenerator.GenerateSingleTeam(config.Context);

            createTeamResult = await helper.CreateTeamResponse(team, loginResult.BodyJson <LoginResponse>().Token);

            role             = DataGenerator.GenerateSigleRole(config.Context, "Admin");
            createRoleResult = await helper.CreateRoleResponse(role, loginResult.BodyJson <LoginResponse>().Token);

            assignRoleResult = await helper.AssignRoleResponse(createRoleResult.BodyJson <Role>().Id,
                                                               createTeamResult.BodyJson <Team>().Id, loginResult.BodyJson <LoginResponse>().User.Id,
                                                               loginResult.BodyJson <LoginResponse>().Token);
        }
Example #11
0
        private async Task User_tries_to_create_new_channel_providing_channel_name_with_non_admin_account()
        {
            team = DataGenerator.GenerateSingleTeam(config.Context);


            createTeamResult = await helper.CreateTeamResponse(team, loginResult.BodyJson <LoginResponse>().Token);



            var user2 = DataGenerator.GenerateSingleUser(config.Context);

            registerResult = await helper.RegisterResponse(user2);

            assignRoleResult = await helper.AssignRoleResponse(createRoleResult.BodyJson <Role>().Id,
                                                               createTeamResult.BodyJson <Team>().Id, registerResult.BodyJson <User>().Id,
                                                               loginResult.BodyJson <LoginResponse>().Token);


            var channel = DataGenerator.GenerateSingleChannel(config.Context, createTeamResult.BodyJson <Team>().Id);

            createChannelResult = await helper.CreateChannelResponse(channel, registerResult.BodyJson <User>().Id,
                                                                     loginResult.BodyJson <LoginResponse>().Token);
        }
Example #12
0
 private Task Channel_name_change_successful()
 {
     Assert.Equal("Developer", editChannelNameResult.BodyJson <Channel>().ChannelName);
     return(Task.CompletedTask);
 }
Example #13
0
 private Task Role_request_successful()
 {
     Assert.Equal(role.Name, getRoleResult.BodyJson <Role>().Name);
     return(Task.CompletedTask);
 }
Example #14
0
 private Task List_retrieved_successfully()
 {
     Assert.Equal(channels.Count, retrievedChannelListResult.BodyJson <List <Channel> >().Count);
     return(Task.CompletedTask);
 }
Example #15
0
 private Task Role_list_successfully_retrieved()
 {
     Assert.NotEmpty(getRoleListResult.BodyJson <List <Role> >());
     return(Task.CompletedTask);
 }
Example #16
0
 private async Task User_tries_to_create_new_channel_providing_channel_name_that_already_exists()
 {
     createNewChannelResult = await helper.CreateChannelResponse(createChannelResult.BodyJson <Channel>(),
                                                                 loginResult.Body.DeserializeJson <LoginResponse>().User.Id, loginResult.BodyJson <LoginResponse>().Token);
 }
Example #17
0
 private Task New_messages_are_retrieved_successfuly()
 {
     Assert.NotEmpty(newMessageList.BodyJson <List <Message> >());
     return(Task.CompletedTask);
 }
Example #18
0
 private Task Team_delete_successfully()
 {
     Assert.Equal("Deleted", deleteTeamResult.BodyJson <Msg>().Message);
     return(Task.CompletedTask);
 }
Example #19
0
 private Task Role_deletion_successful()
 {
     Assert.Equal("Role Deleted", deleteRoleResult.BodyJson <Msg>().Message);
     return(Task.CompletedTask);
 }
Example #20
0
 private async Task Role_is_then_deleted()
 {
     deleteRoleResult = await helper.DeleteRoleResponse(createRoleResult.BodyJson <Role>().Id,
                                                        loginResult.BodyJson <LoginResponse>().Token);
 }
Example #21
0
 private async Task Role_is_being_created()
 {
     role             = DataGenerator.GenerateSigleRole(config.Context, "Developer");
     createRoleResult = await helper.CreateRoleResponse(role, loginResult.BodyJson <LoginResponse>().Token);
 }
Example #22
0
 private Task Role_unassign_successful()
 {
     StepExecution.Current.Comment(unsignRoleResult.BodyJson <Msg>().Message);
     Assert.Equal("Role Unassigned", unsignRoleResult.BodyJson <Msg>().Message);
     return(Task.CompletedTask);
 }
Example #23
0
 private Task Channel_deleteion_successful()
 {
     Assert.Equal("Channel Deleted", deleteChannelResult.BodyJson <Msg>().Message);
     return(Task.CompletedTask);
 }
Example #24
0
 private Task List_retrieved_successfully()
 {
     Assert.NotEmpty(teamListResult.BodyJson <List <Team> >());
     return(Task.CompletedTask);
 }
Example #25
0
 private Task Channel_retrieved_successfully()
 {
     Assert.Equal(createChannelResult.BodyJson <Channel>().Id, getChannelResult.BodyJson <Channel>().Id);
     return(Task.CompletedTask);
 }
Example #26
0
 private async Task Role_is_assigned_to_a_user_belonging_to_a_certain_team()
 {
     assignRoleResult = await helper.AssignRoleResponse(createRoleResult.BodyJson <Role>().Id,
                                                        createTeamResult.BodyJson <Team>().Id, loginResult.BodyJson <LoginResponse>().User.Id,
                                                        loginResult.BodyJson <LoginResponse>().Token);
 }
Example #27
0
 private Task Request_failed()
 {
     Assert.Equal(HttpStatusCode.Unauthorized, unsignRoleResult.StatusCode);
     Assert.Equal("Not authorized", unsignRoleResult.BodyJson <Msg>().Message);
     return(Task.CompletedTask);
 }
Example #28
0
 private Task Remove_user_successful()
 {
     Assert.Equal("User Removed", removeUserResult.BodyJson <Msg>().Message);
     return(Task.CompletedTask);
 }
Example #29
0
 private Task Role_edit_successful()
 {
     Assert.Equal("Hello", editRoleResult.BodyJson <Role>().Name);
     return(Task.CompletedTask);
 }
Example #30
0
 private async Task User_tries_to_create_new_team_providing_team_name()
 {
     createTeamResult = await helper.CreateTeamResponse(team, loginResult.BodyJson <LoginResponse>().Token);
 }