コード例 #1
0
        public void UserCanProvideCustomProjectComponentsService()
        {
            // Arrange
            var projects = new Mock <IProjectService>();
            var client   = new Mock <IJiraRestClient>();
            var jira     = Jira.CreateRestClient(client.Object);

            var remoteProject = new RemoteProject()
            {
                id = "projId", key = "projKey", name = "my project"
            };

            projects.Setup(s => s.GetProjectsAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(Enumerable.Repeat(new Project(jira, remoteProject), 1)));
            jira.Services.Register <IProjectService>(() => projects.Object);

            var componentResource = new Mock <IProjectComponentService>();
            var remoteComponent   = new RemoteComponent()
            {
                id = "123", name = "my component"
            };
            var component = new ProjectComponent(remoteComponent);

            componentResource.Setup(s => s.GetComponentsAsync("projKey", CancellationToken.None))
            .Returns(Task.FromResult(Enumerable.Repeat <ProjectComponent>(component, 1)));

            jira.Services.Register <IProjectComponentService>(() => componentResource.Object);

            // Act
            var components = jira.Projects.GetProjectsAsync().Result.First().GetComponetsAsync().Result;

            // Assert
            Assert.Equal("my component", components.First().Name);
        }
コード例 #2
0
ファイル: Submission.cs プロジェクト: mo5h/omeo
        /// <summary>
        /// Implements the submission on the network thread.
        /// </summary>
        protected void Submit_Run()
        {
            if (!Core.NetworkAP.IsOwnerThread)
            {
                throw new InvalidOperationException("The submission impl must be run on the network thread.");
            }

            try
            {
                SetStatus("Collecting initial parameters");

                RemoteIssue issue = new RemoteIssue();
                issue.project     = Project.Key;
                issue.reporter    = Project.Server.Username;
                issue.type        = IssueType.JiraId.ToString();
                issue.summary     = Title;
                issue.description = Body;

                if (Priority != null)
                {
                    issue.priority = Priority.JiraId.ToString();
                }

                if (Component != null)
                {
                    RemoteComponent rc = new RemoteComponent();
                    rc.id            = Component.JiraId;
                    issue.components = new RemoteComponent[] { rc };
                }

                if (Status != null)
                {
                    issue.status = Status.JiraId;
                }

                issue.assignee = Assignee;

                // Create the issue!
                SetStatus("Creating issue carcass");
                _issue = Project.Server.Service.createIssue(Project.Server.GetSignInToken(), issue);

                // In case JIRA rejects some of the issue params at the creation time, set them one-by-one
                Submit_Run_UpdateIssue();

                // Submit the attachments
                AddAttachmentsToIssue();

                SetStatus("Done");
            }
            catch (Exception ex)
            {
                ErrorLog.AppendFormat("FATAL ERROR. {0}", ex.Message);
            }
            finally
            {
                Core.UserInterfaceAP.QueueJob("JIRA Issue Submission Done.", (MethodInvoker)Submit_Done);
            }
        }
コード例 #3
0
            public void IfFieldsSet_ShouldPopulateFields()
            {
                var jira    = TestableJira.Create();
                var issue   = jira.CreateIssue("ProjectKey");
                var version = new RemoteVersion()
                {
                    id = "1"
                }.ToLocal(issue.Jira);
                var component = new RemoteComponent()
                {
                    id = "1"
                }.ToLocal();

                jira.IssueTypeService.Setup(s => s.GetIssueTypesAsync(CancellationToken.None))
                .Returns(Task.FromResult(Enumerable.Repeat(new IssueType("4", "issuetype"), 1)));
                jira.IssuePriorityService.Setup(s => s.GetPrioritiesAsync(CancellationToken.None))
                .Returns(Task.FromResult(Enumerable.Repeat(new IssuePriority("1", "priority"), 1)));

                issue.AffectsVersions.Add(version);
                issue.Assignee = "assignee";
                issue.Components.Add(component);
                // issue.CustomFields <-- requires extra setup, test below
                issue.Description = "description";
                issue.DueDate     = new DateTime(2011, 1, 1);
                issue.Environment = "environment";
                issue.FixVersions.Add(version);
                // issue.Key <-- should be non-settable
                issue.Priority = "1";
                // issue.Project <-- should be non-settable
                issue.Reporter = "reporter";
                issue.Summary  = "summary";
                issue.Type     = "4";

                var remoteIssue = issue.ToRemote();

                Assert.Single(remoteIssue.affectsVersions);
                Assert.Equal("assignee", remoteIssue.assignee);
                Assert.Single(remoteIssue.components);
                Assert.Null(remoteIssue.created);
                Assert.Equal("description", remoteIssue.description);
                Assert.Equal(new DateTime(2011, 1, 1), remoteIssue.duedate);
                Assert.Equal("environment", remoteIssue.environment);
                Assert.Null(remoteIssue.key);
                Assert.Equal("1", remoteIssue.priority.id);
                Assert.Equal("ProjectKey", remoteIssue.project);
                Assert.Equal("reporter", remoteIssue.reporter);
                Assert.Null(remoteIssue.resolution);
                Assert.Null(remoteIssue.status);
                Assert.Equal("summary", remoteIssue.summary);
                Assert.Equal("4", remoteIssue.type.id);
                Assert.Null(remoteIssue.updated);
            }
コード例 #4
0
        private JiraComponent CreateComponent(RemoteComponent componentJira)
        {
            ResourceProxy proxy = ResourceProxy.BeginNewResource(Types.JiraComponent);

            proxy.AsyncPriority = JobPriority.Normal;

            proxy.SetProp(Props.JiraId, componentJira.id);
            proxy.AddLink(Core.Props.Parent, Resource);

            proxy.EndUpdate();

            return(GetComponent(proxy.Resource));
        }
コード例 #5
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            AggregateFactory = new AggregateFactory(this);

            // Initialize Components
            PlayerComponent         = new PlayerComponent();
            LocalComponent          = new LocalComponent();
            RemoteComponent         = new RemoteComponent();
            PositionComponent       = new PositionComponent();
            MovementComponent       = new MovementComponent();
            MovementSpriteComponent = new MovementSpriteComponent();
            SpriteComponent         = new SpriteComponent();

            base.Initialize();
        }
コード例 #6
0
ファイル: JiraComponent.cs プロジェクト: mo5h/omeo
        public void Sync(RemoteComponent componentJira)
        {
            ResourceProxy proxy = new ResourceProxy(Resource, AsyncPriority);

            proxy.BeginUpdate();

            proxy.SetProp(Core.Props.Name, componentJira.name);

            if (Async)
            {
                proxy.EndUpdateAsync();
            }
            else
            {
                proxy.EndUpdate();
            }
        }
コード例 #7
0
            public void IfComponentsAdded_ReturnsFields()
            {
                var issue = new RemoteIssue()
                {
                    key = "foo"
                }.ToLocal();
                var component = new RemoteComponent()
                {
                    id = "1", name = "1.0"
                };

                issue.Components.Add(component.ToLocal());

                var fields = GetUpdatedFieldsForIssue(issue);

                Assert.Equal(1, fields.Length);
                Assert.Equal("components", fields[0].id);
                Assert.Equal("1", fields[0].values[0]);
            }
コード例 #8
0
            public async Task IfComponentsAdded_ReturnsFields()
            {
                var issue = new RemoteIssue()
                {
                    key = "foo"
                }.ToLocal(TestableJira.Create());
                var component = new RemoteComponent()
                {
                    id = "1", name = "1.0"
                };

                issue.Components.Add(component.ToLocal());

                var fields = await GetUpdatedFieldsForIssueAsync(issue);

                Assert.Single(fields);
                Assert.Equal("components", fields[0].id);
                Assert.Equal("1", fields[0].values[0]);
            }
コード例 #9
0
            public void IfFieldsSet_ShouldPopulateFields()
            {
                var issue     = CreateIssue("ProjectKey");
                var version   = new RemoteVersion().ToLocal();
                var component = new RemoteComponent().ToLocal();

                issue.AffectsVersions.Add(version);
                issue.Assignee = "assignee";
                issue.Components.Add(component);
                // issue.CustomFields <-- requires extra setup, test below
                issue.Description = "description";
                issue.DueDate     = new DateTime(2011, 1, 1);
                issue.Environment = "environment";
                issue.FixVersions.Add(version);
                // issue.Key <-- should be non-settable
                issue.Priority = "1";
                // issue.Project <-- should be non-settable
                issue.Reporter = "reporter";
                issue.Summary  = "summary";
                issue.Type     = "4";
                issue.Votes    = 1;

                var remoteIssue = issue.ToRemote();

                Assert.Equal(1, remoteIssue.affectsVersions.Length);
                Assert.Equal("assignee", remoteIssue.assignee);
                Assert.Equal(1, remoteIssue.components.Length);
                Assert.Null(remoteIssue.created);
                Assert.Equal("description", remoteIssue.description);
                Assert.Equal(new DateTime(2011, 1, 1), remoteIssue.duedate);
                Assert.Equal("environment", remoteIssue.environment);
                Assert.Null(remoteIssue.key);
                Assert.Equal("1", remoteIssue.priority);
                Assert.Equal("ProjectKey", remoteIssue.project);
                Assert.Equal("reporter", remoteIssue.reporter);
                Assert.Null(remoteIssue.resolution);
                Assert.Null(remoteIssue.status);
                Assert.Equal("summary", remoteIssue.summary);
                Assert.Equal("4", remoteIssue.type);
                Assert.Null(remoteIssue.updated);
                Assert.Equal(1, remoteIssue.votes);
            }
コード例 #10
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            AggregateFactory   = new AggregateFactory(this);
            WeaponFactory      = new WeaponFactory(this);
            DoorFactory        = new DoorFactory(this);
            RoomFactory        = new RoomFactory(this);
            CollectableFactory = new CollectibleFactory(this);
            WallFactory        = new WallFactory(this);
            EnemyFactory       = new EnemyFactory(this);
            SkillEntityFactory = new SkillEntityFactory(this);
            NPCFactory         = new NPCFactory(this);

            // Initialize Components
            PlayerComponent          = new PlayerComponent();
            LocalComponent           = new LocalComponent();
            RemoteComponent          = new RemoteComponent();
            PositionComponent        = new PositionComponent();
            MovementComponent        = new MovementComponent();
            MovementSpriteComponent  = new MovementSpriteComponent();
            SpriteComponent          = new SpriteComponent();
            DoorComponent            = new DoorComponent();
            RoomComponent            = new RoomComponent();
            HUDSpriteComponent       = new HUDSpriteComponent();
            HUDComponent             = new HUDComponent();
            InventoryComponent       = new InventoryComponent();
            InventorySpriteComponent = new InventorySpriteComponent();
            ContinueNewGameScreen    = new ContinueNewGameScreen(graphics, this);
            EquipmentComponent       = new EquipmentComponent();
            WeaponComponent          = new WeaponComponent();
            BulletComponent          = new BulletComponent();
            PlayerInfoComponent      = new PlayerInfoComponent();
            WeaponSpriteComponent    = new WeaponSpriteComponent();
            StatsComponent           = new StatsComponent();
            EnemyAIComponent         = new EnemyAIComponent();
            NpcAIComponent           = new NpcAIComponent();

            CollectibleComponent = new CollectibleComponent();
            CollisionComponent   = new CollisionComponent();
            TriggerComponent     = new TriggerComponent();
            EnemyComponent       = new EnemyComponent();
            NPCComponent         = new NPCComponent();
            //QuestComponent = new QuestComponent();
            LevelManager             = new LevelManager(this);
            SpriteAnimationComponent = new SpriteAnimationComponent();
            SkillProjectileComponent = new SkillProjectileComponent();
            SkillAoEComponent        = new SkillAoEComponent();
            SkillDeployableComponent = new SkillDeployableComponent();
            SoundComponent           = new SoundComponent();
            ActorTextComponent       = new ActorTextComponent();
            TurretComponent          = new TurretComponent();
            TrapComponent            = new TrapComponent();
            ExplodingDroidComponent  = new ExplodingDroidComponent();
            HealingStationComponent  = new HealingStationComponent();
            PortableShieldComponent  = new PortableShieldComponent();
            PortableStoreComponent   = new PortableStoreComponent();
            ActiveSkillComponent     = new ActiveSkillComponent();
            PlayerSkillInfoComponent = new PlayerSkillInfoComponent();
            MatchingPuzzleComponent  = new MatchingPuzzleComponent();
            pI = new PlayerInfo();

            Quests = new List <Quest>();


            #region Initialize Effect Components
            AgroDropComponent          = new AgroDropComponent();
            AgroGainComponent          = new AgroGainComponent();
            BuffComponent              = new BuffComponent();
            ChanceToSucceedComponent   = new ChanceToSucceedComponent();
            ChangeVisibilityComponent  = new ChangeVisibilityComponent();
            CoolDownComponent          = new CoolDownComponent();
            DamageOverTimeComponent    = new DamageOverTimeComponent();
            DirectDamageComponent      = new DirectDamageComponent();
            DirectHealComponent        = new DirectHealComponent();
            FearComponent              = new FearComponent();
            HealOverTimeComponent      = new HealOverTimeComponent();
            PsiOrFatigueRegenComponent = new PsiOrFatigueRegenComponent();
            InstantEffectComponent     = new InstantEffectComponent();
            KnockBackComponent         = new KnockBackComponent();
            TargetedKnockBackComponent = new TargetedKnockBackComponent();
            ReduceAgroRangeComponent   = new ReduceAgroRangeComponent();
            ResurrectComponent         = new ResurrectComponent();
            StunComponent              = new StunComponent();
            TimedEffectComponent       = new TimedEffectComponent();
            EnslaveComponent           = new EnslaveComponent();
            CloakComponent             = new CloakComponent();
            #endregion

            base.Initialize();
        }
コード例 #11
0
 /// <summary>
 /// Creates a new Component from RemoteComponent
 /// </summary>
 public static ProjectComponent ToLocal(this RemoteComponent remoteComponent)
 {
     return(new ProjectComponent(remoteComponent));
 }
コード例 #12
0
 /// <summary>
 /// Creates a new instance of ProjectComponent.
 /// </summary>
 /// <param name="remoteComponent">The remote component.</param>
 public ProjectComponent(RemoteComponent remoteComponent)
     : base(remoteComponent)
 {
     _remoteComponent = remoteComponent;
 }
コード例 #13
0
 internal ProjectComponent(RemoteComponent remoteComponent)
     : base(remoteComponent)
 {
     _remoteComponent = remoteComponent;
 }
コード例 #14
0
ファイル: JiraSoapClient.cs プロジェクト: robspages/JiraSharp
        public RemoteIssue addNewIssue(string summary, int IssueTypeID, RemoteComponent[] ComponentArray)
        {
            RemoteIssue issue = new RemoteIssue();
            issue.summary = summary;
            issue.type = issueTypes[IssueTypeID].name;
            issue.components = ComponentArray;

            return addNewIssue(issue);
        }
コード例 #15
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            AggregateFactory = new AggregateFactory(this);
            WeaponFactory = new WeaponFactory(this);
            DoorFactory = new DoorFactory(this);
            RoomFactory = new RoomFactory(this);
            CollectableFactory = new CollectibleFactory(this);
            WallFactory = new WallFactory(this);
            EnemyFactory = new EnemyFactory(this);

            // Initialize Components
            PlayerComponent = new PlayerComponent();
            LocalComponent = new LocalComponent();
            RemoteComponent = new RemoteComponent();
            PositionComponent = new PositionComponent();
            MovementComponent = new MovementComponent();
            MovementSpriteComponent = new MovementSpriteComponent();
            SpriteComponent = new SpriteComponent();
            DoorComponent = new DoorComponent();
            RoomComponent = new RoomComponent();
            HUDSpriteComponent = new HUDSpriteComponent();
            HUDComponent = new HUDComponent();
            InventoryComponent = new InventoryComponent();
            InventorySpriteComponent = new InventorySpriteComponent();
            ContinueNewGameScreen = new ContinueNewGameScreen(graphics, this);
            EquipmentComponent = new EquipmentComponent();
            WeaponComponent = new WeaponComponent();
            BulletComponent = new BulletComponent();
            PlayerInfoComponent = new PlayerInfoComponent();
            WeaponSpriteComponent = new WeaponSpriteComponent();
            StatsComponent = new StatsComponent();
            EnemyAIComponent = new EnemyAIComponent();
            CollectibleComponent = new CollectibleComponent();
            CollisionComponent = new CollisionComponent();
            TriggerComponent = new TriggerComponent();
            EnemyComponent = new EnemyComponent();
            QuestComponent = new QuestComponent();
            LevelManager = new LevelManager(this);
            SpriteAnimationComponent = new SpriteAnimationComponent();
            SkillProjectileComponent = new SkillProjectileComponent();
            SkillAoEComponent = new SkillAoEComponent();
            SkillDeployableComponent = new SkillDeployableComponent();

            //TurretComponent = new TurretComponent();
            //TrapComponent = new TrapComponent();
            //PortableShopComponent = new PortableShopComponent();
            //PortableShieldComponent = new PortableShieldComponent();
            //MotivateComponent =  new MotivateComponent();
            //FallbackComponent = new FallbackComponent();
            //ChargeComponent = new ChargeComponent();
            //HealingStationComponent = new HealingStationComponent();
            //ExplodingDroidComponent = new ExplodingDroidComponent();

            base.Initialize();
        }
コード例 #16
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            AggregateFactory = new AggregateFactory(this);

            // Initialize Components
            PlayerComponent = new PlayerComponent();
            LocalComponent = new LocalComponent();
            RemoteComponent = new RemoteComponent();
            PositionComponent = new PositionComponent();
            MovementComponent = new MovementComponent();
            MovementSpriteComponent = new MovementSpriteComponent();
            SpriteComponent = new SpriteComponent();

            base.Initialize();
        }
コード例 #17
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            AggregateFactory = new AggregateFactory(this);
            WeaponFactory = new WeaponFactory(this);
            DoorFactory = new DoorFactory(this);
            RoomFactory = new RoomFactory(this);
            CollectableFactory = new CollectibleFactory(this);
            WallFactory = new WallFactory(this);
            EnemyFactory = new EnemyFactory(this);
            SkillEntityFactory = new SkillEntityFactory(this);
            NPCFactory = new NPCFactory(this);

            // Initialize Components
            PlayerComponent = new PlayerComponent();
            LocalComponent = new LocalComponent();
            RemoteComponent = new RemoteComponent();
            PositionComponent = new PositionComponent();
            MovementComponent = new MovementComponent();
            MovementSpriteComponent = new MovementSpriteComponent();
            SpriteComponent = new SpriteComponent();
            DoorComponent = new DoorComponent();
            RoomComponent = new RoomComponent();
            HUDSpriteComponent = new HUDSpriteComponent();
            HUDComponent = new HUDComponent();
            InventoryComponent = new InventoryComponent();
            InventorySpriteComponent = new InventorySpriteComponent();
            ContinueNewGameScreen = new ContinueNewGameScreen(graphics, this);
            EquipmentComponent = new EquipmentComponent();
            WeaponComponent = new WeaponComponent();
            BulletComponent = new BulletComponent();
            PlayerInfoComponent = new PlayerInfoComponent();
            WeaponSpriteComponent = new WeaponSpriteComponent();
            StatsComponent = new StatsComponent();
            EnemyAIComponent = new EnemyAIComponent();
            NpcAIComponent = new NpcAIComponent();

            CollectibleComponent = new CollectibleComponent();
            CollisionComponent = new CollisionComponent();
            TriggerComponent = new TriggerComponent();
            EnemyComponent = new EnemyComponent();
            NPCComponent = new NPCComponent();
            //QuestComponent = new QuestComponent();
            LevelManager = new LevelManager(this);
            SpriteAnimationComponent = new SpriteAnimationComponent();
            SkillProjectileComponent = new SkillProjectileComponent();
            SkillAoEComponent = new SkillAoEComponent();
            SkillDeployableComponent = new SkillDeployableComponent();
            SoundComponent = new SoundComponent();
            ActorTextComponent = new ActorTextComponent();
            TurretComponent = new TurretComponent();
            TrapComponent = new TrapComponent();
            ExplodingDroidComponent = new ExplodingDroidComponent();
            HealingStationComponent = new HealingStationComponent();
            PortableShieldComponent = new PortableShieldComponent();
            PortableStoreComponent = new PortableStoreComponent();
            ActiveSkillComponent = new ActiveSkillComponent();
            PlayerSkillInfoComponent = new PlayerSkillInfoComponent();

            Quests = new List<Quest>();

            #region Initialize Effect Components
            AgroDropComponent = new AgroDropComponent();
            AgroGainComponent = new AgroGainComponent();
            BuffComponent = new BuffComponent();
            ChanceToSucceedComponent = new ChanceToSucceedComponent();
            ChangeVisibilityComponent = new ChangeVisibilityComponent();
            CoolDownComponent = new CoolDownComponent();
            DamageOverTimeComponent = new DamageOverTimeComponent();
            DirectDamageComponent = new DirectDamageComponent();
            DirectHealComponent = new DirectHealComponent();
            FearComponent = new FearComponent();
            HealOverTimeComponent = new HealOverTimeComponent();
            InstantEffectComponent = new InstantEffectComponent();
            KnockBackComponent = new KnockBackComponent();
            TargetedKnockBackComponent = new TargetedKnockBackComponent();
            ReduceAgroRangeComponent = new ReduceAgroRangeComponent();
            ResurrectComponent = new ResurrectComponent();
            StunComponent = new StunComponent();
            TimedEffectComponent = new TimedEffectComponent();
            EnslaveComponent = new EnslaveComponent();
            CloakComponent = new CloakComponent();
            #endregion

            base.Initialize();
        }
コード例 #18
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            AggregateFactory = new AggregateFactory(this);

            // Initialize Components
            PlayerComponent = new PlayerComponent();
            LocalComponent = new LocalComponent();
            RemoteComponent = new RemoteComponent();
            PositionComponent = new PositionComponent();
            MovementComponent = new MovementComponent();
            MovementSpriteComponent = new MovementSpriteComponent();
            SpriteComponent = new SpriteComponent();
            DoorComponent = new DoorComponent();
            RoomComponent = new RoomComponent();
            HUDSpriteComponent = new HUDSpriteComponent();
            HUDComponent = new HUDComponent();

            CharacterSelectionScreen = new CharacterSelectionScreen(graphics, this);

            LevelManager = new LevelManager(this);

            base.Initialize();
        }