public void Foo()
        {
            var reader = new TestableSvnReaderService();
            IEventManager eventManager = new EventManager();
            reader.Initialize(Config, eventManager, null);

            eventManager.Publish(new SvnReaderHostedService.SvnReaderIntervalSync());
        }
        public void ProcessRevisionOnlyOnce()
        {
            string referenceExpression = "[A-Z]{1,2}-+[0-9]{4}";

            var reader = new TestableSvnReaderService();
            IEventManager eventManager = new EventManager();
            reader.Initialize(Config, eventManager, null);

            reader.TestOnRevision(new SvnConnector.RevisionArgs(1, "Author", DateTime.Now, "message", new List<string>(), new ChangeSetDictionary()), referenceExpression);
            ChangeSetInfo firstResult = reader.LastChangeSet;

            reader.TestOnRevision(new SvnConnector.RevisionArgs(1, "Author", DateTime.Now, "message", new List<string>(), new ChangeSetDictionary()), referenceExpression);
            ChangeSetInfo secondResult = reader.LastChangeSet;

            Assert.AreSame(firstResult, secondResult);
        }
        private static void AssertOnChangeSet(string referenceExpression, int expectedRevision, List<string> references, List<string> changedFiles,
            int expectedLastRevision)
        {
            var reader = new TestableSvnReaderService();
            IEventManager eventManager = new EventManager();
            reader.Initialize(Config, eventManager, null);
            string expectedMessage = string.Format("{0} Exposed the Fronat API", string.Join(", ", references.ToArray()));
            var sourceOfExpected = new ChangeSetInfo("ExpectedAuthor", expectedMessage, new List<string>(), expectedRevision.ToString(), DateTime.Now, new List<string>());
            foreach(string reference in references) {
                sourceOfExpected.References.Add(reference);
            }
            foreach(string file in changedFiles) {
                sourceOfExpected.ChangedFiles.Add(file);
            }

            reader.LastRevisionNumber = expectedLastRevision;
            reader.TestProcessRevision(sourceOfExpected.RevisionAsInteger, sourceOfExpected.Author, sourceOfExpected.ChangeDate,
                sourceOfExpected.Message, sourceOfExpected.ChangedFiles, referenceExpression);

            ChangeSetInfo result = reader.LastChangeSet;

            Assert.AreEqual(sourceOfExpected.Author, result.Author);
            Assert.AreEqual(sourceOfExpected.ChangeDate, result.ChangeDate);
            Assert.AreEqual(sourceOfExpected.ChangedFiles.Count, result.ChangedFiles.Count, "ChangedFile cound does not match.");
            foreach(string file in sourceOfExpected.ChangedFiles) {
                Assert.IsTrue(result.ChangedFiles.Contains(file), "Result should contain changed file \"{0}\"", file);
            }

            Assert.AreEqual(sourceOfExpected.Message, result.Message);
            Assert.AreEqual(sourceOfExpected.References.Count, result.References.Count, "Reference Count does not match.");
            foreach(string reference in sourceOfExpected.References) {
                Assert.IsTrue(result.References.Contains(reference), "Result should contain reference \"{0}\".", reference);
            }

            Assert.AreEqual(sourceOfExpected.Revision, result.Revision);
            Assert.AreEqual(sourceOfExpected.Revision, reader.LastRevisionNumber.ToString());
        }