public void ShouldBuildIndexesCorrectlyOnProfileCreation()
        {
            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));

            _transport.HandleLocalMessage(profile, new GeneralProjectChangedLocalMessage {
                ProjectId = 2, GeneralId = 2
            });

            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 ShouldBuildIndexesCorrectlyOnProfileCreation()
        {
            var profile = _transport.AddProfile("Test", new SearcherProfile());

            CheckByState("general", 11, new[] { 1, 2 });
            CheckByState("general", 12, new[] { 1, 2 }, resultCount: 2);

            _assignables = new[]
            {
                new AssignableDTO {
                    ID = 2, EntityStateID = 14, SquadID = 10, ProjectID = 1, EntityTypeID = QueryEntityTypeProvider.USERSTORY_TYPE_ID
                },
                new AssignableDTO {
                    ID = 3, EntityStateID = 15, SquadID = 11, ProjectID = 1, EntityTypeID = QueryEntityTypeProvider.BUG_TYPE_ID
                }
            };

            _transport.HandleLocalMessage(profile, new ProjectProcessChangedLocalMessage {
                ProjectId = 1
            });

            CheckByState("general", 14, new[] { 1, 2 });
            CheckByState("general", 15, new[] { 1, 2 });
            CheckByState("general", 12, new[] { 1, 2 }, resultCount: 1);

            var queryRunner = ObjectFactory.GetInstance <QueryRunner>();
            var result      = queryRunner.Run(new QueryData
            {
                Query          = "general",
                EntityStateIds = new[] { 11 },
                ProjectIds     = new[] { 1 }
            });

            result.Total.Should(Be.EqualTo(0));
        }
Beispiel #3
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 Init()
		{
			_transport = TransportMock.CreateWithoutStructureMapClear(typeof (CreateTasksForNewUserStoryHandler).Assembly);

			const int projectId = 123;
			const int userStoryId = 123;
			_profileInstance = _transport.AddProfile("Profile1",
			                                         new TaskCreatorProfile
			                                         	{Project = projectId, TasksList = "Task", CommandName = "{CT}"});

			_userStoryCreatedMessage = new UserStoryCreatedMessage
			                           	{
			                           		Dto =
			                           			new UserStoryDTO
			                           				{
			                           					ProjectID = projectId,
			                           					UserStoryID = userStoryId,
			                           					Name = "{CT}User Story Name"
			                           				}
			                           	};
		}
        public void Init()
        {
            _transport = TransportMock.CreateWithoutStructureMapClear(typeof(CreateTasksForNewUserStoryHandler).Assembly);

            const int projectId   = 123;
            const int userStoryId = 123;

            _profileInstance = _transport.AddProfile("Profile1",
                                                     new TaskCreatorProfile
            {
                Project = projectId, TasksList = "Task", CommandName = "{CT}"
            });

            _userStoryCreatedMessage = new UserStoryCreatedMessage
            {
                Dto =
                    new UserStoryDTO
                {
                    ProjectID   = projectId,
                    UserStoryID = userStoryId,
                    Name        = "{CT}User Story Name"
                }
            };
        }
Beispiel #6
0
 public void AddProfileWithDefaultRolesMapping(string profileName, int projectId, BugzillaProfile profile)
 {
     SetDefaultRolesMapping(profile);
     TransportMock.AddProfile(profileName, profile);
 }
Beispiel #7
0
 public void AddProfile(string profileName, int projectId)
 {
     TransportMock.AddProfile(profileName, GetBugzillaProfile(projectId));
 }
Beispiel #8
0
 public void AddProfileWithDefaultRolesMapping(string profileName, int projectId)
 {
     TransportMock.AddProfile(profileName, GetBugzillaProfileWithDefaultRolesMapping(projectId));
 }
 public void CreateProfileForAccount(string profileName, string accountName)
 {
     TransportMock.AddProfile(profileName, accountName, new MashupManagerProfile());
 }
 public void CreateProfile(string profileName)
 {
     TransportMock.AddProfile(profileName, new MashupManagerProfile());
 }
 public void AddProfile(string profileName)
 {
     TransportMock.AddProfile(profileName, GetTfsPluginProfile());
 }
 public void Init()
 {
     _handled   = false;
     _transport = TransportMock.CreateWithoutStructureMapClear(typeof(ReplyMessage).Assembly, Assembly.GetExecutingAssembly());
     _transport.AddProfile("Profile_1");
 }