public void GetByExtension_ShouldReturnNotSupportedReaderWhenNoReaderFoundForGivenExtension() { var readers = new IDataReader[] { new OneReader(), new TwoReader(), new ThreeReader(), }; var provider = new DataReaderProvider(readers); var actualReader = provider.GetByExtension("test"); actualReader.Should().BeOfType <NotSupportedDataReader>(); }
private static MainViewModel InitializeViewModelWithDependencies() { const char CSV_COLUMN_DELIMETER = ','; var readers = new IDataReader[] { new ExcelDataReader(), new CsvDataReader(CSV_COLUMN_DELIMETER), new JsonDataReader() }; var readerProvider = new DataReaderProvider(readers); var dataProvider = new FileDataProvider(readerProvider); var calculator = new ScatterReportCalculator(); return(new MainViewModel(dataProvider, calculator)); }
public void GetByExtension_ShouldReturnReaderWhichTypeDecoratedWithGivenExtension() { var expectedReader = new OneReader(); var readers = new IDataReader[] { new TwoReader(), expectedReader, new ThreeReader() }; var provider = new DataReaderProvider(readers); var actualReader = provider.GetByExtension("csv"); actualReader.Should().BeSameAs(expectedReader); }
public void GetByExtension_ShouldReturnSameReaderForTwoExtensionsWhenReaderSupportsGivenExtensions() { var expectedReader = new TwoReader(); var readers = new IDataReader[] { new OneReader(), new ThreeReader(), expectedReader }; var provider = new DataReaderProvider(readers); var xlsReader = provider.GetByExtension("xls"); var xlsxReader = provider.GetByExtension("xlsx"); xlsReader.Should().BeSameAs(expectedReader); xlsReader.Should().BeSameAs(xlsxReader); }