public void ShouldThrowExceptionWhenNoStrategyFoundForFile()
        {
            // Given
            CompositeProductFileImport composite = anyNotSupported();
            StreamReader reader = readNotSupportedFile();

            // Then
            Assert.Throws <ArgumentException>(() => composite.Import(reader));
        }
        public void ShouldUseCsvFileImportWheMultipleStrategiesArePresent()
        {
            // Given
            CompositeProductFileImport composite = csvAndJsonSupported();
            StreamReader reader = readEmptyCsvTestFile();

            // When
            List <Product> result = composite.Import(reader);

            // Then
            Assert.IsEmpty(result);
        }
        public void ShouldUseJsonFileImportWhenMultipleStrategiesArePresent()
        {
            // Given
            CompositeProductFileImport composite = csvAndJsonSupported();
            StreamReader reader = readJsonTestFile();

            List <Product> expectedResult = new List <Product>();

            expectedResult.Add(new Product(1, "name", "category", 2.50, 10));
            expectedResult.Add(new Product(2, "name2", "category", 3.20, 1));

            // When
            List <Product> result = composite.Import(reader);

            // Then
            Assert.AreEqual(expectedResult[0], result[0]);
            Assert.AreEqual(expectedResult[1], result[1]);
        }