public void TestMethod1() { //Produit p = new Produit("58", "aziz", "eeee"); //IDAoImpProduit daopr = new IDAoImpProduit(); //bool veri=daopr.ajout(p); //Assert.IsTrue(veri); //IFakeDAO fake = Substitute.For<ISQliteDB>(); // fake.ajout().Returns(true); // ConsoleProduit d = new ConsoleProduit(); // bool pp = d.ajoutt(fake); // Assert.IsTrue(pp); //Arrange var sqlite = new SQLiteDb(); var productStore = new SQLiteProductStore(sqlite); var pageService = Substitute.For <IPageService>(); var addService = Subtitute.For <IProductStore>(); var vm = new ProductsPageViewModel(productStore, pageService); //Act vm.LoadDataCommand.Execute(null); var x = vm.Products; vm.AddProductCommand.Execute(null); //Assert Assert.IsNotNull(x); }
public ProductsPage() { var productStore = new SQLiteProductStore(DependencyService.Get <ISQLiteDb>()); var pageService = new PageService(); ViewModel = new ProductsPageViewModel(productStore, pageService); InitializeComponent(); }
public ProductsDetailPage(ProductViewModel viewModel) { InitializeComponent(); var productStore = new SQLiteProductStore(DependencyService.Get <ISQLiteDb>()); var pageService = new PageService(); Title = (viewModel.ProductName == null) ? "New Product" : "Edit Product"; BindingContext = new ProductsDetailViewModel(viewModel ?? new ProductViewModel(), productStore, pageService); }