Exemplo n.º 1
0
        public void ShouldThrowFileNotFoundException(string userInput)
        {
            string outputFormat = "importing: Name: \"{0}\";  Categories: {1}; Twitter: {2}";

            ProductsFeedImporter.ProductsFeedImporter productImporter = new ProductsFeedImporter.ProductsFeedImporter(outputFormat);
            var ex = Assert.Throws <FileNotFoundException>(() => productImporter.ImportProductDetails(userInput));
        }
Exemplo n.º 2
0
        public void ShouldThrowInvalidOpException(string userInput)
        {
            string outputFormat = "importing: Name: \"{0}\";  Categories: {1}; Twitter: {2}";

            ProductsFeedImporter.ProductsFeedImporter productImporter = new ProductsFeedImporter.ProductsFeedImporter(outputFormat);
            var ex = Assert.Throws <InvalidOperationException>(() => productImporter.ImportProductDetails(userInput));

            Assert.Equal("Invalid input! Valid Syntax: <import> <capterra/softwareadvice/..> <file full path>", ex.Message);
        }
Exemplo n.º 3
0
        public void ShouldThrowException_ProviderNotSupported(string userInput)
        {
            string outputFormat = "importing: Name: \"{0}\";  Categories: {1}; Twitter: {2}";

            ProductsFeedImporter.ProductsFeedImporter productImporter = new ProductsFeedImporter.ProductsFeedImporter(outputFormat);
            var ex = Assert.Throws <InvalidOperationException>(() => productImporter.ImportProductDetails(userInput));

            Assert.Equal("Provider not supported!", ex.Message);
        }
Exemplo n.º 4
0
        public void ShouldImportProductDetails(string userInput)
        {
            string outputFormat = "importing: Name: \"{0}\";  Categories: {1}; Twitter: {2}";

            ProductsFeedImporter.ProductsFeedImporter productImporter = new ProductsFeedImporter.ProductsFeedImporter(outputFormat);
            var feeds     = productImporter.ImportProductDetails(userInput);
            int resultLen = feeds != null ? feeds.Count : 0;

            Assert.NotNull(feeds);
            Assert.True(resultLen > 0);
        }