当前位置: 首页>>代码示例>>C#>>正文


C# MainWindowViewModel.AddTransactionItem方法代码示例

本文整理汇总了C#中MainWindowViewModel.AddTransactionItem方法的典型用法代码示例。如果您正苦于以下问题:C# MainWindowViewModel.AddTransactionItem方法的具体用法?C# MainWindowViewModel.AddTransactionItem怎么用?C# MainWindowViewModel.AddTransactionItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MainWindowViewModel的用法示例。


在下文中一共展示了MainWindowViewModel.AddTransactionItem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddDuplicateTest

 public void AddDuplicateTest()
 {
     var mock = new Mock<IProductService>();
     List<ProductDTO> mockProduct = new List<ProductDTO>{
             new ProductDTO
             {
                 UPC = "1"
             }};
     mock.Setup(framework => framework.GetAllProducts())
         .Returns(mockProduct);
     mock.Setup(framework => framework.GetProductByUPC("1"))
         .Returns(mockProduct.First(x => x.UPC == "1"));
     MainWindowViewModel testVM = new MainWindowViewModel(mock.Object);
     testVM.AddTransactionItem("1");
     testVM.AddTransactionItem("1");
     CollectionAssert.AreEquivalent(mockProduct, testVM.TransactionProducts.Select(x => x.Item).ToList());
     Assert.AreEqual(2, testVM.TransactionProducts[0].Quantity);
 }
开发者ID:CIT275DevGroup,项目名称:openTill,代码行数:18,代码来源:GUI.MainWindowViewModelTest.cs

示例2: ChangeQty

 public void ChangeQty()
 {
     var mock = new Mock<IProductService>();
     List<ProductDTO> mockProduct = new List<ProductDTO>{
             new ProductDTO
             {
                 UPC = "1"
             }};
     mock.Setup(framework => framework.GetAllProducts())
         .Returns(mockProduct);
     mock.Setup(framework => framework.GetProductByUPC("1"))
         .Returns(mockProduct.First(x => x.UPC == "1"));
     MainWindowViewModel testVM = new MainWindowViewModel(mock.Object);
     testVM.AddTransactionItem("1");
     testVM.SelectedItem = testVM.TransactionProducts[0];
     testVM.ChangeItemQuantity(3);
     Assert.AreEqual(4, testVM.TransactionProducts[0].Quantity);
 }
开发者ID:CIT275DevGroup,项目名称:openTill,代码行数:18,代码来源:GUI.MainWindowViewModelTest.cs

示例3: RemoveProductTest

 public void RemoveProductTest()
 {
     var mock = new Mock<IProductService>();
     List<ProductDTO> mockProduct = new List<ProductDTO>{
             new ProductDTO
             {
                 UPC = "1"
             }};
     mock.Setup(framework => framework.GetAllProducts())
         .Returns(mockProduct);
     mock.Setup(framework => framework.GetProductByUPC("1"))
         .Returns(mockProduct.First(x => x.UPC == "1"));
     MainWindowViewModel testVM = new MainWindowViewModel(mock.Object);
     testVM.AddTransactionItem("1");
     testVM.SelectedItem = testVM.TransactionProducts[0];
     testVM.RemoveTransactionItem();
     Assert.IsTrue(testVM.TransactionProducts.Count == 0);
 }
开发者ID:CIT275DevGroup,项目名称:openTill,代码行数:18,代码来源:GUI.MainWindowViewModelTest.cs


注:本文中的MainWindowViewModel.AddTransactionItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。