public void OutputStillMatchesCharacterization() { var inputsAndExpectations = new Dictionary <string, string>() { { "empty-fie.txt", "expectation-empty-file.text" }, { "one-field.txt", "expectation-one-field.txt" }, { "malformed-currency-pair.txt", "expectation-malformed-currency-pair.txt" }, { "trade-volume-invalid.txt", "expectation-trade-volume-invalid.txt" }, { "trade-amount-invalid.txt", "expectation-trade-amount-invalid.txt" }, { "correct-format.txt", "expectation-correct-format.txt" } }; var originalConsoleOut = Console.Out; foreach (var pair in inputsAndExpectations) { var input = typeof(TradeProcessor).Assembly.GetManifestResourceStream(typeof(TradeProcessor), pair.Key); var expectation = File.ReadAllText(Path.Combine(CharacterizationTestOutput, pair.Value)); string actual = null; using (var memoryStream = new MemoryStream()) { using (var streamwriter = new StreamWriter(memoryStream)) { Console.SetOut(streamwriter); var tradeProcessor = new TradeProcessor(); tradeProcessor.ProcessTrades(input); streamwriter.Flush(); memoryStream.Seek(0, SeekOrigin.Begin); actual = new StreamReader(memoryStream).ReadToEnd(); } } } }
static void Main(string[] args) { ITradeDataProvider dataProvider = Dependancies.TradeDataProvider; ITradeParser tradeParser = Dependancies.TradeParser; ITradeStorage tradeStorage = Dependancies.TradeStorage; var batchProcessor = new TradeProcessor(dataProvider, tradeParser, tradeStorage); batchProcessor.ProcessTrades(); }
//[ExpectedException(typeof(ArgumentNullException))] public void EmptyTestFile() { //Arrange var tradeStream = "http://faculty.css.edu/tgibbons/trades4.txt"; var tradeProcessor = new TradeProcessor(); //Act tradeProcessor.ProcessTrades(tradeStream); //Assert }
//[ExpectedException(typeof(ArgumentNullException))] public void EmptyTestFile() { //Arrange var tradeStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("SingleResponsibilityPrincipleTests.tradesEmpty.txt"); var tradeProcessor = new TradeProcessor(); //Act tradeProcessor.ProcessTrades(tradeStream); //Assert }
public void NoTestFile() { //Arrange var tradeStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(""); var tradeProcessor = new TradeProcessor(); //Act tradeProcessor.ProcessTrades(tradeStream); //Assert }
public void TestTradeAmountBoounds() { // Arrange var tradeStream = "http://faculty.css.edu/tgibbons/trades4.txt"; var tradeProcessor = new TradeProcessor(); int startCount = CountDbRecords(); // Act tradeProcessor.ProcessTrades(tradeStream); int endCount = CountDbRecords(); // Assert Assert.AreEqual(endCount - startCount, 2); }
public void TestTradeAmountBoounds() { // Arrange var tradeStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("SingleResponsibilityPrincipleTests.tradesBounds.txt"); var tradeProcessor = new TradeProcessor(); int startCount = CountDbRecords(); // Act tradeProcessor.ProcessTrades(tradeStream); int endCount = CountDbRecords(); // Assert Assert.AreEqual(endCount - startCount, 2); }
//[ExpectedException(typeof(ArgumentNullException))] public void EmptyTestFile() { //Arrange string url = "http://faculty.css.edu/tgibbons/tradesempty.txt"; var tradeProcessor = new TradeProcessor(); //Act tradeProcessor.ProcessTrades(url); //Assert }
public void NoTestFile() { //Arrange string url = ""; var tradeProcessor = new TradeProcessor(); //Act tradeProcessor.ProcessTrades(url); //Assert }
void Main(){ Stream s = new(); System.Data.SqlClient.SqlConnection coneccion = new(); // ITradeDataProvider provider = new ITradeDataProvider(s); ITradeDataProvider provider = new ProvidePrueba(); ITradeParser parse = new tradeParser(); StoreNull store = new StoreNull(); TradeProcessor t = new TradeProcessor(provider, parse, store); t.ProcessTrades(); Console.WriteLine($"Se grabaron {store.contador}"); }
static void Main(string[] args) { var serilogLogger = new LoggerConfiguration() .WriteTo.File("log.txt", rollingInterval: RollingInterval.Day) .CreateLogger(); IRateMyAgentLogger logger = new RateMyAgentLogger(serilogLogger); IRepository repository = new SqlServerRepository(); ITradeRecordParser parser = new TradeRecordParser(logger); ITradeStreamReader reader = new HardcodedTradeStreamReader(); ITradeProcessor processor = new TradeProcessor(logger, repository, parser, reader); processor.ProcessTrades(); }
public void TestTradeAmountBoounds() { // Arrange //var tradeStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("SingleResponsibilityPrincipleTests.tradesBounds.txt"); string url = "http://faculty.css.edu/tgibbons/tradesBounds.txt"; var tradeProcessor = new TradeProcessor(); int startCount = CountDbRecords(); // Act //tradeProcessor.ProcessTrades(tradeStream); tradeProcessor.ProcessTrades(url); int endCount = CountDbRecords(); // Assert Assert.AreEqual(endCount - startCount, 2); }
public void Run() { TradeProcessor processor = new TradeProcessor(); processor.ProcessTrades(); }