public void GetWorkitemsReadyForSynchronisationTest()
        {
            //given
            ExternalWorkitemQuerier target = new ExternalWorkitemQuerier();
            DateTime modifiedSince = new DateTime(2012, 1, 1);
            string lastModifiedWorkitemId = String.Empty;
            string sourceName = env.GetVersionOneSource;
            string externalIdFieldName = env.GetVersionOneReference;

            //when
            WorkitemStateChangeCollection actual = target.GetWorkitemsReadyForSynchronisation(modifiedSince, sourceName, externalIdFieldName, lastModifiedWorkitemId);

            //then
            Console.WriteLine(string.Format("Found {0} items", actual.Count));
            Assert.AreNotEqual(0, actual);

            foreach (var item in actual) {
                Console.WriteLine(string.Format("Item externalId is {0}", item.ExternalId));
            }
        }
        public void GetNewWorkitemsTest()
        {
            //given
            ExternalWorkitemQuerier target = new ExternalWorkitemQuerier();
            DateTime lastCreatedTimestamp = new DateTime(2012, 1, 1);
            string lastCreatedWorkitemId = String.Empty;
            List<String> scopes = new List<string>() {"Scope:2257958" };

            //when
            var results = target.GetNewWorkitems(lastCreatedTimestamp, lastCreatedWorkitemId, scopes);

            //then
            Console.WriteLine(string.Format("Found {0} items", results.Count));
            Assert.AreNotEqual(0, results.Count);

            foreach (var item in results)
            {
                Console.WriteLine(string.Format("Item externalId is {0}", item.ExternalId));
            }
        }
        private void InitializeComponents()
        {
            v1Processor = new VersionOneProcessor(configElement["Settings"], logger);
            ComponentRepository.Instance.Register(v1Processor);
            ComponentRepository.Instance.Register(logger);

            workitemWriter = new WorkitemWriter(externalIdFieldName);
            externalWorkitemsQuerier = new ExternalWorkitemQuerier();

            v1Processor.AddProperty(Entity.NameProperty, VersionOneProcessor.PrimaryWorkitemType, false);
            v1Processor.AddProperty(ServerConnector.Entities.Workitem.DescriptionProperty, VersionOneProcessor.PrimaryWorkitemType, false);
            v1Processor.AddProperty(ServerConnector.Entities.Workitem.NumberProperty, VersionOneProcessor.PrimaryWorkitemType, false);
            //v1Processor.AddProperty(ServerConnector.Entities.Workitem.OwnersProperty, VersionOneProcessor.PrimaryWorkitemType, false);
            v1Processor.AddProperty(ServerConnector.Entities.Workitem.OwnersUsernamesProperty, VersionOneProcessor.PrimaryWorkitemType, false);
            v1Processor.AddProperty(externalIdFieldName, VersionOneProcessor.PrimaryWorkitemType, false);
            v1Processor.AddProperty(Entity.ChangeDateUtcProperty, VersionOneProcessor.PrimaryWorkitemType, false);
            v1Processor.AddProperty(Entity.ScopeProperty, VersionOneProcessor.PrimaryWorkitemType, false);
            v1Processor.AddProperty(Entity.ScopeNameProperty, VersionOneProcessor.DefectType, false);
            v1Processor.AddProperty(Entity.CreateDateUtcProperty, VersionOneProcessor.PrimaryWorkitemType, false);
            v1Processor.AddProperty(Entity.CreatedByUsernameProperty, VersionOneProcessor.PrimaryWorkitemType, false);
            v1Processor.AddProperty(Entity.StatusNameProperty, VersionOneProcessor.PrimaryWorkitemType, false);
            v1Processor.AddProperty(Entity.StatusProperty, VersionOneProcessor.PrimaryWorkitemType, true);
            v1Processor.AddProperty(Entity.SourceProperty, VersionOneProcessor.PrimaryWorkitemType, true);
            v1Processor.AddProperty(ServerConnector.Entities.Workitem.PriorityProperty, VersionOneProcessor.PrimaryWorkitemType, true); // to get options list
            v1Processor.AddProperty(ServerConnector.Entities.Workitem.PriorityProperty, VersionOneProcessor.PrimaryWorkitemType, false);

            v1Processor.AddProperty(Entity.NameProperty, VersionOneProcessor.DefectType, false);
            v1Processor.AddProperty(ServerConnector.Entities.Workitem.DescriptionProperty, VersionOneProcessor.DefectType, false);
            v1Processor.AddProperty(ServerConnector.Entities.Workitem.NumberProperty, VersionOneProcessor.DefectType, false);
            //v1Processor.AddProperty(ServerConnector.Entities.Workitem.OwnersProperty, VersionOneProcessor.DefectType, false);
            v1Processor.AddProperty(ServerConnector.Entities.Workitem.OwnersUsernamesProperty, VersionOneProcessor.DefectType, false);
            v1Processor.AddProperty(externalIdFieldName, VersionOneProcessor.DefectType, false);
            v1Processor.AddProperty(Entity.ChangeDateUtcProperty, VersionOneProcessor.DefectType, false);
            v1Processor.AddProperty(Entity.ScopeProperty, VersionOneProcessor.DefectType, false);
            v1Processor.AddProperty(Entity.ScopeNameProperty, VersionOneProcessor.DefectType, false);
            v1Processor.AddProperty(Entity.CreateDateUtcProperty, VersionOneProcessor.DefectType, false);
            v1Processor.AddProperty(Entity.CreatedByUsernameProperty, VersionOneProcessor.DefectType, false);
            v1Processor.AddProperty(Entity.StatusProperty, VersionOneProcessor.DefectType, true);
            v1Processor.AddProperty(Entity.SourceProperty, VersionOneProcessor.DefectType, true);
            v1Processor.AddProperty(ServerConnector.Entities.Workitem.PriorityProperty, VersionOneProcessor.DefectType, false);
            v1Processor.AddProperty(ServerConnector.Entities.Workitem.FoundInBuildProperty, VersionOneProcessor.DefectType, false); // defect-only
            v1Processor.AddProperty(VersionOneProcessor.EnvironmentAttribute, VersionOneProcessor.DefectType, false); // defect-only
            v1Processor.AddProperty(ServerConnector.Entities.Workitem.SeverityLevelProperty, VersionOneProcessor.DefectType, true);

            v1Processor.AddProperty(Entity.NameProperty, VersionOneProcessor.StoryType, false);
            v1Processor.AddProperty(ServerConnector.Entities.Workitem.DescriptionProperty, VersionOneProcessor.StoryType, false);
            v1Processor.AddProperty(ServerConnector.Entities.Workitem.NumberProperty, VersionOneProcessor.StoryType, false);
            //v1Processor.AddProperty(ServerConnector.Entities.Workitem.OwnersProperty, VersionOneProcessor.StoryType, false);
            v1Processor.AddProperty(ServerConnector.Entities.Workitem.OwnersUsernamesProperty, VersionOneProcessor.StoryType, false);
            v1Processor.AddProperty(externalIdFieldName, VersionOneProcessor.StoryType, false);
            v1Processor.AddProperty(Entity.ChangeDateUtcProperty, VersionOneProcessor.StoryType, false);
            v1Processor.AddProperty(Entity.ScopeProperty, VersionOneProcessor.StoryType, false);
            v1Processor.AddProperty(Entity.ScopeNameProperty, VersionOneProcessor.StoryType, false);
            v1Processor.AddProperty(ServerConnector.Entities.Workitem.PriorityProperty, VersionOneProcessor.StoryType, false);
            v1Processor.AddProperty(Entity.CreateDateUtcProperty, VersionOneProcessor.StoryType, false);
            v1Processor.AddProperty(Entity.CreatedByUsernameProperty, VersionOneProcessor.StoryType, false);
            v1Processor.AddProperty(Entity.StatusProperty, VersionOneProcessor.StoryType, true);
            v1Processor.AddProperty(Entity.SourceProperty, VersionOneProcessor.StoryType, true);

            v1Processor.AddProperty(Member.NameProperty, VersionOneProcessor.MemberType, false);
            v1Processor.AddProperty(Member.UsernameProperty, VersionOneProcessor.MemberType, false);

            ComponentRepository.Instance.Register(workitemWriter);
            ComponentRepository.Instance.Register(externalWorkitemsQuerier);
        }