Example #1
0
        static void Main(string[] args)
        {
            using (var dialog = new System.Windows.Forms.FolderBrowserDialog())
            {
                System.Windows.Forms.DialogResult result = dialog.ShowDialog();
            }

            BusinessStockManager MonStock = new BusinessStockManager(new DataBaseArticleManager());

            MonStock.AddArticle("4700", "Oeufs", 1.5f, 180, true);
            MonStock.AddArticle("4700", "Oeufs test", 5f, 1000, true);
            MonStock.AddArticle("9000", "Lait de riz", 1.2f, 780, true);
            MonStock.AddArticle("0096", "Pizza", 3f, 500, true);
            MonStock.AfficherArticles();
            var MaRef = MonStock.RechercheParRef("4545");

            //MonStock.SupprimerParRef("9000");
            MonStock.ModifierParRef("0096", "Pizza 3 fromages");
            var MaModif = MonStock.RechercheParRef("0096");

            Console.WriteLine(MaModif);
            MonStock.ModifierParRef("0096", null, 4f);
            Console.WriteLine(MaModif);
            MonStock.ModifierParRef("0096", null, null, 1975);
            Console.WriteLine(MaModif);

            List <Article> MonStockFiltre = MonStock.RechercheParIntervallePrix(1, 2);

            //MonStockFiltre.AfficherArticles();

            Console.ReadLine();
        }
        public void RechercheParIntervallePrix()
        {
            var mock = new Mock <IDataBaseArticleManager>();

            mock.Setup(x => x.RechercheParIntervallePrix(25, 50)).Returns(() => new List <DataBaseArticle>());
            var aTester = new BusinessStockManager(mock.Object);

            var maListe = aTester.RechercheParIntervallePrix(25, 50);

            Assert.AreEqual(0, maListe.Count);
            mock.Verify(x => x.RechercheParIntervallePrix(25, 50), Times.Once());
        }