Exemple #1
0
        public void useAddedUnitTest()
        {
            Unit unit = new Unit {
                Name = "tona", Value = 1000000, Base = UnitBase.Weight
            };

            unitsViewModel.AddUnit(unit);

            Product cukier = productsViewModel.ProductsCollection[1];
            ProductDetailsViewModel productDetailsViewModel = new ProductDetailsViewModel(cukier, unitsDataStore);

            Unit gram = unitsViewModel.UnitsCollection[0];
            Unit tona = unitsViewModel.UnitsCollection[unitsViewModel.UnitsCollection.Count - 1];

            productDetailsViewModel.UnitA  = gram;
            productDetailsViewModel.UnitB  = tona;
            productDetailsViewModel.ValueA = 1000000;

            productDetailsViewModel.CalculateB();

            Assert.AreEqual(1, productDetailsViewModel.ValueB);
        }
 void AddUnit(object sender, System.EventArgs e)
 {
     viewModel.AddUnit();
     UnitsLV.ItemsSource = viewModel.UnitsCollection;
 }