public void CreateConverterTest() { string provider = "GoogleProvider"; IConverter expected = new CsvConverter(); IConverter actual; actual = _converterFactory.Create(provider); Assert.AreEqual(expected.ToString(), actual.ToString()); Assert.AreNotSame(expected, actual); }
public void ConvertTest() { string providerData = "Date,Open,High,Low,Close,Volume\n18-Jun-12,29.99,30.03,29.71,29.84,58285251\n"; IEnumerable<Quote> actual; Mock<IConverter> conv = new Mock<IConverter>(); conv.Setup(c => c.Convert(providerData)).Returns(_quotes); var fakeQuotes = conv.Object.Convert(providerData); var converter = new CsvConverter(); var realQuotes = converter.Convert(providerData); Assert.AreNotEqual(null, realQuotes.FirstOrDefault()); Assert.AreEqual(realQuotes.Count(), fakeQuotes.Count()); var f = realQuotes.Select(quote => quote.Close); var q = fakeQuotes.Select(quote => quote.Close); Assert.AreEqual(realQuotes.Select(quote => quote.Close).First(), fakeQuotes.Select(quote => quote.Close).First()); Assert.IsTrue(realQuotes.All(quote => quote.Volume > default(double))); }
public static void MyClassInitialize(TestContext testContext) { _converter = new CsvConverter(); }