Example #1
0
        public void CacheEntries_WithVariousOptions_ShouldSetupPropertiesGetWorkItemsAndSave(bool includeComments, bool assignedInclude, bool statesExclude, bool typesInclude, string fromChangedString)
        {
            EFVSTSWorkItems efvstsWorkItems = new EFVSTSWorkItems(_context.Object, _config.Object, _iAPIMethod.Object);

            DateTime?fromChanged = null;

            if (!string.IsNullOrEmpty(fromChangedString))
            {
                fromChanged = DateTime.Parse(fromChangedString);
            }

            List <string> assignedToInclude = GenerateStringList(assignedInclude);
            List <string> statesToExclude   = GenerateStringList(statesExclude);
            List <string> typesToInclude    = GenerateStringList(typesInclude);

            efvstsWorkItems.CacheEntries(includeComments, assignedToInclude,
                                         statesToExclude, typesToInclude, fromChanged);

            _iAPIMethod.Verify(x => x.GetWorkItems(), Times.Once);
            _context.Verify(x => x.SaveChanges(), Times.Once);
            Assert.AreEqual(includeComments, _includeComments);
            Assert.AreEqual(fromChanged, _fromDate);
            CollectionAssert.AreEqual(assignedToInclude, _iAPIMethod.Object.AssignedToInclude);
            CollectionAssert.AreEqual(statesToExclude, _iAPIMethod.Object.StatesToExclude);
            CollectionAssert.AreEqual(typesToInclude, _iAPIMethod.Object.TypesToInclude);
        }
Example #2
0
        public void Constructor_ShouldSetPropertiesAndCallConfig()
        {
            EFVSTSWorkItems efvstsWorkItems = new EFVSTSWorkItems(_context.Object, _config.Object, _iAPIMethod.Object);

            _config.Verify(x => x.GetKey(It.IsAny <string>()), Times.Exactly(3));
            Assert.IsNotNull(efvstsWorkItems.Entries);
            Assert.IsNotNull(efvstsWorkItems.Organization);
            Assert.IsNotNull(efvstsWorkItems.Project);
            Assert.IsNotNull(efvstsWorkItems.ApiKey);
        }
        private void CacheVSTS()
        {
            WriteTimeLog("--CacheVSTS", "Starting");
            IVSTSWorkItems efVSTS = new EFVSTSWorkItems();

            List <string> assignedToInclude = _configuration.GetCollection("APISources:VSTS:AssignedToInclude");
            List <string> statesToExclude   = _configuration.GetCollection("APISources:VSTS:StatesToExclude");
            List <string> typesToInclude    = _configuration.GetCollection("APISources:VSTS:TypesToInclude");
            DateTime      fromDate          = GetFromDay("VSTS:FromDateDays");
            bool          includeComments   = Boolean.Parse(_configuration.GetKey("APISources:VSTS:IncludeComments"));

            efVSTS.CacheEntries(includeComments, assignedToInclude, statesToExclude, typesToInclude, fromDate);
        }