Exemplo n.º 1
0
 public void PluginCommandMessageReceived(string commandName, string arguments)
 {
     _transportMock.HandleMessageFromTp(
         new List <HeaderInfo> {
         new HeaderInfo {
             Key = BusExtensions.ACCOUNTNAME_KEY, Value = AccountName.Empty.Value
         }
     },
         new ExecutePluginCommandCommand {
         CommandName = commandName, Arguments = arguments
     });
 }
        public void UpdateBugEntityStateAndResolution(string bugName, string resolutionComment, string entityState)
        {
            var state = Context.EntityStates.Single(s => s.Name == entityState);

            var bug = Context.TpBugs.Single(b => b.Name == bugName);

            bug.EntityStateID   = state.ID;
            bug.EntityStateName = state.Name;

            if (!string.IsNullOrEmpty(resolutionComment))
            {
                if (resolutionComment.Contains(':'))
                {
                    var pair         = resolutionComment.Split(':');
                    var duplicateBug = Context.TpBugs.Single(b => b.Name == pair[1]);
                    resolutionComment = resolutionComment.Replace(pair[1], "#" + duplicateBug.ID);
                }

                bug.CommentOnChangingState = resolutionComment;
            }

            TransportMock.HandleMessageFromTp(new BugUpdatedMessage
            {
                Dto           = bug,
                ChangedFields = new[] { BugField.EntityStateID }
            });
        }
Exemplo n.º 3
0
        public void AssignDeveloper(string userLogin, string bugName)
        {
            BugDTO  bug           = Context.TpBugs.Single(b => b.Name == bugName);
            RoleDTO developerRole = Context.Roles.Single(r => r.Name == "Developer");
            UserDTO user          = Context.Users.Single(u => u.Login == userLogin);

            var existingDeveloperTeam =
                Context.TpTeams.Where(t => t.AssignableID == bug.ID)
                .Where(t => t.RoleID == developerRole.ID)
                .Single();

            TransportMock.HandleMessageFromTp(new TeamCreatedMessage
            {
                Dto =
                    new TeamDTO
                {
                    ID           = Context.GetNextId(),
                    AssignableID = bug.ID,
                    RoleID       = developerRole.ID,
                    RoleName     = developerRole.Name,
                    UserID       = user.ID
                }
            });

            existingDeveloperTeam.RoleName = developerRole.Name;
            TransportMock.HandleMessageFromTp(new TeamDeletedMessage {
                Dto = existingDeveloperTeam
            });
        }
Exemplo n.º 4
0
        public void ShouldUpdateCommentProjectIndexWhenProjectChanged()
        {
            var profile     = _transport.AddProfile("Test", new SearcherProfile());
            var queryRunner = ObjectFactory.GetInstance <QueryRunner>();
            var result      = queryRunner.Run(new QueryData
            {
                Query        = "Description",
                EntityTypeId = QueryEntityTypeProvider.COMMENT_TYPE_ID,
                ProjectIds   = new[] { 1 }
            });

            result.Total.Should(Be.EqualTo(1));

            var       generalDto   = _generals.First();
            const int newProjectId = 2;

            _transport.HandleMessageFromTp(profile, new UserStoryUpdatedMessage
            {
                Dto = new UserStoryDTO
                {
                    ID           = generalDto.ID,
                    EntityTypeID = generalDto.EntityTypeID,
                    ProjectID    = newProjectId
                },
                ChangedFields = new[] { UserStoryField.ProjectID }
            });

            _transport.HandleLocalMessage(profile, new GeneralProjectChangedLocalMessage {
                ProjectId = newProjectId, GeneralId = generalDto.ID.GetValueOrDefault()
            });

            queryRunner = ObjectFactory.GetInstance <QueryRunner>();
            queryRunner.Run(new QueryData
            {
                Query        = "Description",
                EntityTypeId = QueryEntityTypeProvider.COMMENT_TYPE_ID,
                ProjectIds   = new[] { 1 }
            }).Total.Should(Be.EqualTo(0));

            queryRunner = ObjectFactory.GetInstance <QueryRunner>();
            queryRunner.Run(new QueryData
            {
                Query        = "Description",
                EntityTypeId = QueryEntityTypeProvider.COMMENT_TYPE_ID,
                ProjectIds   = new[] { 2 }
            }).Total.Should(Be.EqualTo(1));
        }
        public void ShouldCreateTask()
        {
            _transport.HandleMessageFromTp(_userStoryCreatedMessage);

            var taskDto = _transport.TpQueue.GetMessages <CreateCommand>().Last().Dto as TaskDTO;

            taskDto.UserStoryID.Should(Be.EqualTo(_userStoryCreatedMessage.Dto.UserStoryID));
            taskDto.Name.Should(Be.EqualTo(_profileInstance.GetProfile <TaskCreatorProfile>().TasksList));
        }
        public void HandleDelete(int id, int processId, string entityTypeName)
        {
            var entityState = new EntityStateDTO {
                ID = id, EntityStateID = id, ProcessID = processId, EntityTypeName = entityTypeName
            };

            TransportMock.HandleMessageFromTp(Profile, new EntityStateDeletedMessage {
                Dto = entityState
            });
        }
        public void HandleDelete(int id, string entityTypeName)
        {
            var priority = new PriorityDTO {
                ID = id, PriorityID = id, EntityTypeName = entityTypeName
            };

            TransportMock.HandleMessageFromTp(Profile, new PriorityDeletedMessage {
                Dto = priority
            });
        }
Exemplo n.º 8
0
        public void HandleDelete(int id, string email)
        {
            var user = new UserDTO {
                ID = id, Email = email
            };

            TransportMock.HandleMessageFromTp(Profile, new UserDeletedMessage {
                Dto = user
            });
        }
Exemplo n.º 9
0
        public void HandlCreateInactiveWithLogin(int id, string login, string email)
        {
            var user = new UserDTO {
                ID = id, Login = login, Email = email, IsActive = false
            };

            TransportMock.HandleMessageFromTp(Profile, new UserCreatedMessage {
                Dto = user
            });
        }
 public void ChangeProjectsProcess(int projectId, int newProcessId)
 {
     TransportMock.HandleMessageFromTp(new ProjectUpdatedMessage
     {
         Dto = new ProjectDTO {
             ID = projectId, ProcessID = newProcessId
         },
         ChangedFields = new[] { ProjectField.ProcessID }
     });
 }
Exemplo n.º 11
0
        public void HandleDelete(int id)
        {
            var severity = new SeverityDTO {
                ID = id, SeverityID = id
            };

            TransportMock.HandleMessageFromTp(Profile, new SeverityDeletedMessage {
                Dto = severity
            });
        }
        public void HandleUpdate(int id, string name)
        {
            var project = new ProjectDTO {
                ID = id, ProjectID = id, Name = name
            };

            TransportMock.HandleMessageFromTp(Profile, new ProjectUpdatedMessage {
                Dto = project
            });
        }
        public void RemoveRole(string roleName)
        {
            var role = Context.Roles.Where(x => x.Name == roleName).Single();

            Context.Roles.Remove(role);
            TransportMock.HandleMessageFromTp(new RoleDeletedMessage
            {
                Dto = role
            });
        }
        public void HandleDelete(int id)
        {
            var project = new ProjectDTO {
                ID = id, ProjectID = id
            };

            TransportMock.HandleMessageFromTp(Profile, new ProjectDeletedMessage {
                Dto = project
            });
        }
Exemplo n.º 15
0
        public void HandleUpdate(int id, string login, string email)
        {
            var user = new UserDTO {
                ID = id, Login = login, Email = email, IsActive = true
            };

            TransportMock.HandleMessageFromTp(Profile, new UserUpdatedMessage {
                Dto = user
            });
        }
Exemplo n.º 16
0
        public void HandleUpdate(int id, string name)
        {
            var severity = new SeverityDTO {
                ID = id, SeverityID = id, Name = name
            };

            TransportMock.HandleMessageFromTp(Profile, new SeverityUpdatedMessage {
                Dto = severity
            });
        }
Exemplo n.º 17
0
        public void SetStringValue(string profileName, string stringValue, string accountName)
        {
            var profileUpdated = new PluginProfileDto
            {
                Name = profileName, Settings = new SampleProfileSerialized {
                    StringValue = stringValue
                }
            };
            var addOrUpdateProfileCmd = new ExecutePluginCommandCommand {
                CommandName = EmbeddedPluginCommands.AddOrUpdateProfile, Arguments = profileUpdated.Serialize()
            };

            _transportMock.HandleMessageFromTp(
                new List <HeaderInfo> {
                new HeaderInfo {
                    Key = BusExtensions.ACCOUNTNAME_KEY, Value = accountName
                }
            },
                addOrUpdateProfileCmd);
        }
Exemplo n.º 18
0
        public void HandleUpdateWithEmailChanged(int id, string login, string email)
        {
            var user = new UserDTO {
                ID = id, Login = login, Email = email, IsActive = true
            };

            TransportMock.HandleMessageFromTp(Profile,
                                              new UserUpdatedMessage {
                Dto = user, ChangedFields = new[] { UserField.Email }
            });
        }
        public void UpdateDescriptionInTp(string bugName, string bugDescription)
        {
            var bug = Context.TpBugs.Single(b => b.Name == bugName);

            bug.Description = bugDescription;
            TransportMock.HandleMessageFromTp(new BugUpdatedMessage
            {
                Dto           = bug,
                ChangedFields = new[] { BugField.Description }
            });
        }
        public void RenameRole(string roleName, string newRoleName)
        {
            var role = Context.Roles.Where(x => x.Name == roleName).Single();

            TransportMock.HandleMessageFromTp(new RoleUpdatedMessage
            {
                Dto = new RoleDTO {
                    ID = role.ID, Name = newRoleName
                },
                ChangedFields = new[] { RoleField.Name }
            });
        }
Exemplo n.º 21
0
        public void ReassignDeveloper(string bugName)
        {
            BugDTO  bug           = Context.TpBugs.Single(b => b.Name == bugName);
            RoleDTO developerRole = Context.Roles.Single(r => r.Name == "Developer");

            var existingDeveloperTeam =
                Context.TpTeams.Where(t => t.AssignableID == bug.ID)
                .Where(t => t.RoleID == developerRole.ID)
                .Single();

            existingDeveloperTeam.RoleName = developerRole.Name;
            TransportMock.HandleMessageFromTp(new TeamDeletedMessage {
                Dto = existingDeveloperTeam
            });
        }
        private void CreateCommentInTargetProcess(string commentText, string owner, int?bugId, DateTime createDate)
        {
            var comment = new CommentDTO
            {
                Description = commentText,
                OwnerID     = Context.Users.Single(u => u.Login == owner).ID,
                GeneralID   = bugId,
                CreateDate  = createDate
            };

            TransportMock.HandleMessageFromTp(new CommentCreatedMessage
            {
                Dto = comment
            });
        }
        private static void UpdateProfile(TransportMock transportMock, IProfileReadonly profile)
        {
            var addOrUpdateProfileCmd = new ExecutePluginCommandCommand
            {
                CommandName = EmbeddedPluginCommands.AddOrUpdateProfile,
                Arguments   = profile.ConvertToDto().Serialize()
            };

            transportMock.HandleMessageFromTp(
                new List <HeaderInfo> {
                new HeaderInfo {
                    Key = BusExtensions.ACCOUNTNAME_KEY, Value = AccountName.Empty.Value
                }
            },
                addOrUpdateProfileCmd);
        }
        public void UpdateEntityStateOfUnsyncBug(string bugName, string entityState)
        {
            var state = Context.EntityStates.Single(s => s.Name == entityState);

            TransportMock.HandleMessageFromTp(new BugUpdatedMessage
            {
                Dto = new BugDTO
                {
                    EntityStateID   = state.ID,
                    EntityStateName = state.Name,
                    ID   = Context.GetNextId(),
                    Name = bugName
                },
                ChangedFields = new[] { BugField.EntityStateID }
            });
        }
Exemplo n.º 25
0
        public void HandleLibraryCommand(string commandName)
        {
            TransportMock.HandleMessageFromTp(
                new List <HeaderInfo>
            {
                new HeaderInfo {
                    Key = BusExtensions.ACCOUNTNAME_KEY, Value = AccountName.Empty.Value
                },
                new HeaderInfo {
                    Key = BusExtensions.PROFILENAME_KEY, Value = Profile.Name.Value
                }
            }
                , new ExecutePluginCommandCommand
            {
                CommandName = commandName
            });

            _response = TransportMock.TpQueue.GetMessages <PluginCommandResponseMessage>().Last();
        }
        private void CreateProfileInitialization(ProjectEmailProfile settings, string profileName)
        {
            var profile = new PluginProfileDto
            {
                Name     = profileName,
                Settings = settings
            };

            var createProfileCmd = new ExecutePluginCommandCommand
            {
                CommandName = EmbeddedPluginCommands.AddProfile, Arguments = profile.Serialize()
            };

            _transportMock.HandleMessageFromTp(
                new List <HeaderInfo> {
                new HeaderInfo {
                    Key = BusExtensions.ACCOUNTNAME_KEY, Value = "Account"
                }
            }, createProfileCmd);
        }
Exemplo n.º 27
0
        private void HandlePluginCommand(string commandName, string args)
        {
            TransportMock.TpQueue.Clear();

            var command = new ExecutePluginCommandCommand {
                CommandName = commandName, Arguments = args
            };

            TransportMock.HandleMessageFromTp(
                new List <HeaderInfo>
            {
                new HeaderInfo {
                    Key = BusExtensions.ACCOUNTNAME_KEY, Value = AccountName.Empty.Value
                },
                new HeaderInfo {
                    Key = BusExtensions.PROFILENAME_KEY, Value = Profile.Name.Value
                }
            },
                command);
        }
Exemplo n.º 28
0
        public void HandleGetPackageDetaildCommand(string repositoryName, string packageName)
        {
            TransportMock.HandleMessageFromTp(
                new List <HeaderInfo>
            {
                new HeaderInfo {
                    Key = BusExtensions.ACCOUNTNAME_KEY, Value = AccountName.Empty.Value
                },
                new HeaderInfo {
                    Key = BusExtensions.PROFILENAME_KEY, Value = Profile.Name.Value
                }
            }
                , new ExecutePluginCommandCommand
            {
                CommandName = "GetPackageDetailed",
                Arguments   = (new PackageCommandArg {
                    RepositoryName = repositoryName, PackageName = packageName
                }).Serialize()
            });

            _response = TransportMock.TpQueue.GetMessages <PluginCommandResponseMessage>().Last();
        }