Example #1
0
        public DictionaryProducts()
        {
            var filePath = ProductsProvider.GetDbPath();
            var obj      = new ProductsProvider(filePath);

            DictionaryOfProducts = obj.GetAllProductsFromDb();
        }
Example #2
0
        public void WhenWrongDatabasePassedThrowFileNotFoundError()
        {
            const string filePath = @"D:\Work\Training\Bootcamp\Products.db";
            var          products = new ProductsProvider(filePath);

            Assert.Throws <FileNotFoundException>(() => products.GetAllProductsFromDb());
        }
Example #3
0
        public void GetAllProductsFromDatabaseWhenCorrectFilePathIsPassed()
        {
            var filePath    = ProductsProvider.GetDbPath();
            var products    = new ProductsProvider(filePath);
            var allProducts = products.GetAllProductsFromDb();

            Assert.True(allProducts.Count != 0);
        }
        public void WhenWrongDatabasePassedThrowFileNotFoundError()
        {
            var filePath = AppDomain.CurrentDomain.BaseDirectory;
            var dbPath   = Path.GetFullPath(Path.Combine(filePath, @"..\..\..\Products.db"));
            var products = new ProductsProvider(dbPath);

            Assert.Throws <FileNotFoundException>(() => products.GetAllProductsFromDb());
        }