public void Calls_ProcessQueue_method_of_IQueueProcessorService() { var queue = new Queue() { QueueItems = new QueueItem[] { new QueueItem() { InputPath = "test", }, } }; mocker.GetMock<ICreateQueueFromPathService>().Setup(a => a.RecursivelyBuildQueueFromPath(It.IsAny<string>())) .Returns(queue); mocker.Resolve<StatefulT4Processor.BatchProcessor.TextTemplateZipProcessor>().ProcessZip("pathToZip", "outputPath"); mocker.GetMock<IQueueProcessorService>().Verify(a => a.ProcessQueue(queue), Times.Once()); }
public string[] ProcessQueue(Queue queue) { string xml; using (var memoryStream = new MemoryStream()) { var serializer = new XmlSerializer(typeof(Queue)); serializer.Serialize(memoryStream, queue); memoryStream.Position = 0; var sr = new StreamReader(memoryStream); xml = sr.ReadToEnd(); } var path = string.Format("{0}QueueProcessorWorkingFolder" + Path.DirectorySeparatorChar + "{1}" + Path.DirectorySeparatorChar, ConfigurationManager.AppSettings["PathToLocalWorkingFolder"], Guid.NewGuid()); if (!Directory.Exists(path)) Directory.CreateDirectory(path); var pathToQueueXmlFile = path + "queue.xml"; using (var file = new StreamWriter(pathToQueueXmlFile)) { file.Write(xml); file.Close(); } var p = new Process { StartInfo = { FileName = ConfigurationManager.AppSettings["PathToT4HostConsoleApplication"], Arguments = string.Format("{0}", pathToQueueXmlFile), UseShellExecute = false, RedirectStandardOutput = true, } }; p.Start(); var consoleOutput = p.StandardOutput.ReadToEnd(); return consoleOutput.Split('\n'); }
public Queue RecursivelyBuildQueueFromPath(string path) { var queue = new Queue(); queue.QueueItems = GetQueueItemsFromPath(path).ToArray(); return queue; }
public string[] ProcessQueue(Queue queue) { throw new NotImplementedException(); }