public void WhenStockSymbolSet_PropertyIsUpdated() { // Prepare string stockSymbol = "StockSymbol"; Mock <IWatchListService> mockWatchListService = new Mock <IWatchListService>(); IWatchListService watchListService = mockWatchListService.Object; AddWatchViewModel target = new AddWatchViewModel(watchListService); bool propertyChangedRaised = false; target.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "StockSymbol") { propertyChangedRaised = true; } }; // Act target.StockSymbol = stockSymbol; // Verify Assert.AreEqual(stockSymbol, target.StockSymbol); Assert.IsTrue(propertyChangedRaised); }
public AddWatchViewModel PrepopulateInputValue(Watch watch, List <Movement> movement, List <WatchModel> watchModel) { var viewModel = new AddWatchViewModel { Movement = movement, WatchModel = watchModel, WatchName = watch.WatchCode, WatchDescription = watch.WatchDescription, ModelId = watch.ModelID, MovementId = watch.MovementID, BandMaterial = watch.BandMaterial, CaseRadius = watch.CaseRadius.GetValueOrDefault(), CaseMaterial = watch.CaseMaterial, Discount = watch.Discount, Quantity = watch.Quantity, Price = watch.Price, Guarantee = watch.Guarantee, Alarm = watch.Alarm, LedLight = watch.LEDLight, WaterResistant = watch.WaterResistant }; return(viewModel); }
public void WhenConstructedWithNullWatchListService_Throws() { // Prepare IWatchListService watchListService = null; // Act AddWatchViewModel actual = new AddWatchViewModel(watchListService); // Verify }
public void WhenConstructed_IntializesValues() { // Prepare ICommand addWatchCommand = new DelegateCommand(() => {}); Mock <IWatchListService> mockWatchListService = new Mock <IWatchListService>(); mockWatchListService.SetupGet(x => x.AddWatchCommand).Returns(addWatchCommand); IWatchListService watchListService = mockWatchListService.Object; // Act AddWatchViewModel actual = new AddWatchViewModel(watchListService); // Verify Assert.IsNotNull(actual); Assert.AreEqual(addWatchCommand, actual.AddWatchCommand); }
public ActionResult AddWatch() { //load movement and model to view var movement = db.Movements.ToList(); var watchModel = db.WatchModels.ToList(); var viewModel = new AddWatchViewModel(movement, watchModel); if (TempData["EXCEL"] != null) { viewModel.InvalidExcelFileMessage = (string)TempData["EXCEL"]; } if (TempData["ZIP"] != null) { viewModel.InvalidZipFileMessage = (string)TempData["ZIP"]; } if (TempData["RESULT"] != null) { viewModel.ImportMessage = (string)TempData["RESULT"]; } return(View("~/Views/Admin/admin_manage_watch_add.cshtml", viewModel)); }
public AddWatchView(AddWatchViewModel viewModel) { InitializeComponent(); this.DataContext = viewModel; }