public MainWindowViewModel(Dispatcher dispatcher)
 {
     EffectManager.Instance.SetDispatcher(dispatcher);
     StatusVm   = new StatusViewModel();
     LightingVm = new LightingViewModel();
     SettingsVm = new SettingsViewModel(dispatcher);
 }
Example #2
0
        public IActionResult Index(LightingViewModel lighting)
        {
            if (ModelState.IsValid)
            {
                lightingService.AddRecord(lighting);
                return(Redirect("/Home/Complete"));
            }

            return(View(lighting));
        }
Example #3
0
 public TopViewModel()
 {
     Keypad                 = new KeypadSerial();
     CurrentPage            = Page.Keybinds;
     keybindsVm             = new KeybindsViewModel(Keypad);
     countersVm             = new CountersViewModel(Keypad);
     debounceVm             = new DebounceViewModel(Keypad);
     lightingVm             = new LightingViewModel(Keypad);
     debugVm                = new DebugViewModel(Keypad);
     TopView.DeviceChanged += CheckConnection;
 }
Example #4
0
        public void AddRecord_WhenCalled_CallsRepositoryWithData()
        {
            var lightingRecord = new LightingViewModel()
            {
                Name                = "Name",
                EmailAddress        = "*****@*****.**",
                AcceptableLighting  = true,
                BrightnessLevel     = 4,
                AddressNameOrNumber = "177",
                AddressLine1        = "Town Street",
                AddressLine2        = "Headingley",
                AddressTown         = "Leeds",
                AddressPostcode     = "LS2 1AA"
            };

            var expectedDateModel = new Lighting()
            {
                Name                = lightingRecord.Name,
                EmailAddress        = lightingRecord.EmailAddress,
                AcceptableLighting  = lightingRecord.AcceptableLighting,
                BrightnessLevel     = lightingRecord.BrightnessLevel,
                AddressNameOrNumber = lightingRecord.AddressNameOrNumber,
                AddressLine1        = lightingRecord.AddressLine1,
                AddressLine2        = lightingRecord.AddressLine2,
                AddressTown         = lightingRecord.AddressTown,
                AddressPostcode     = lightingRecord.AddressPostcode
            };

            var mockRepository = new Mock <IRepository>();

            mockRepository.Setup(x => x.AddRecord(It.IsAny <Lighting>()));

            var lightingService = new LightingService(mockRepository.Object);

            lightingService.AddRecord(lightingRecord);

            mockRepository.Verify(x =>
                                  x.AddRecord(It.Is <Lighting>(m =>
                                                               m.Name == expectedDateModel.Name &&
                                                               m.EmailAddress == expectedDateModel.EmailAddress &&
                                                               m.AcceptableLighting == expectedDateModel.AcceptableLighting &&
                                                               m.BrightnessLevel == expectedDateModel.BrightnessLevel &&
                                                               m.AddressNameOrNumber == expectedDateModel.AddressNameOrNumber &&
                                                               m.AddressLine1 == expectedDateModel.AddressLine1 &&
                                                               m.AddressLine2 == expectedDateModel.AddressLine2 &&
                                                               m.AddressTown == expectedDateModel.AddressTown &&
                                                               m.AddressPostcode == expectedDateModel.AddressPostcode)),
                                  Times.Once);
        }
Example #5
0
 public void AddRecord(LightingViewModel lightingRecord)
 {
     repository.AddRecord(new Lighting
     {
         Name                = lightingRecord.Name,
         EmailAddress        = lightingRecord.EmailAddress,
         AcceptableLighting  = lightingRecord.AcceptableLighting,
         BrightnessLevel     = lightingRecord.BrightnessLevel,
         AddressNameOrNumber = lightingRecord.AddressNameOrNumber,
         AddressLine1        = lightingRecord.AddressLine1,
         AddressLine2        = lightingRecord.AddressLine2,
         AddressTown         = lightingRecord.AddressTown,
         AddressPostcode     = lightingRecord.AddressPostcode
     });
 }