public void CreateConfiguration() { GKManager.DeviceLibraryConfiguration = new GKDeviceLibraryConfiguration(); GKManager.DeviceConfiguration = new GKDeviceConfiguration(); var systemDriver = GKManager.Drivers.FirstOrDefault(x => x.DriverType == GKDriverType.System); Assert.IsNotNull(systemDriver); var systemDevice = GKManager.DeviceConfiguration.RootDevice = new GKDevice { Driver = systemDriver, DriverUID = systemDriver.UID }; gkDevice1 = GKManager.AddDevice(systemDevice, GKManager.Drivers.FirstOrDefault(x => x.DriverType == GKDriverType.GK), 0); kauDevice11 = GKManager.AddDevice(gkDevice1, GKManager.Drivers.FirstOrDefault(x => x.DriverType == GKDriverType.RSR2_KAU), 1); kauDevice12 = GKManager.AddDevice(gkDevice1, GKManager.Drivers.FirstOrDefault(x => x.DriverType == GKDriverType.RSR2_KAU), 2); gkDevice2 = GKManager.AddDevice(systemDevice, GKManager.Drivers.FirstOrDefault(x => x.DriverType == GKDriverType.GK), 0); kauDevice21 = GKManager.AddDevice(gkDevice2, GKManager.Drivers.FirstOrDefault(x => x.DriverType == GKDriverType.RSR2_KAU), 1); kauDevice22 = GKManager.AddDevice(gkDevice2, GKManager.Drivers.FirstOrDefault(x => x.DriverType == GKDriverType.RSR2_KAU), 2); GKManager.UpdateConfiguration(); ClientManager.PlansConfiguration = new PlansConfiguration(); ClientManager.PlansConfiguration.AllPlans = new List<Plan>(); ServiceFactory.Initialize(null, null); ServiceFactory.ResourceService = new MockResourceService(); ServiceFactory.DialogService = MockDialogService = new MockDialogService(); ServiceFactory.MessageBoxService = MockMessageBoxService = new MockMessageBoxService(); ServiceFactory.MenuService = new MenuService(x => { ;}); ServiceFactory.RibbonService = new MockRibbonService(); CreateGroupControllerModule(); }
public void Initialize() { CreateConfiguration(); ServiceFactory.Initialize(null, null); ServiceFactory.ResourceService = new MockResourceService(); ServiceFactory.DialogService = MockDialogService = new MockDialogService(); ServiceFactory.MessageBoxService = MockMessageBoxService = new MockMessageBoxService(); ServiceFactory.MenuService = new MenuService(x => {; }); ServiceFactory.RibbonService = new MockRibbonService(); }
public void InsertGroupDevice() { SetMokForNewDeviceViewModel(GKDriverType.RSR2_AM_1); var devicesViewModel = GroupControllerModule.DevicesViewModel; var selectedDevice = devicesViewModel.SelectedDevice = devicesViewModel.AllDevices.FirstOrDefault(x => x.Driver.DriverType == GKDriverType.RSR2_KAU_Shleif); devicesViewModel.SelectedDevice.AddCommand.Execute(); ServiceFactory.DialogService = MockDialogService = new MockDialogService(); SetMokForNewDeviceViewModel(GKDriverType.RSR2_AM_4); selectedDevice = devicesViewModel.SelectedDevice = devicesViewModel.AllDevices.FirstOrDefault(x => x.Driver.DriverType == GKDriverType.RSR2_AM_1); devicesViewModel.SelectedDevice.AddCommand.Execute(); Assert.IsTrue(selectedDevice.Children.Count() == 0); Assert.IsTrue(selectedDevice.Device.IntAddress == 1); Assert.IsTrue(selectedDevice.Device.Parent.Children.LastOrDefault().IntAddress == 2); Assert.IsTrue(selectedDevice.Device.Parent.Children.LastOrDefault().Parent.DriverType == GKDriverType.RSR2_KAU_Shleif); Assert.IsTrue(selectedDevice.Device.Parent.Children.LastOrDefault().Children.All(x => x.Parent.DriverType == GKDriverType.RSR2_AM_4)); }
public void AddDeviceInStartList() { SetMokForNewDeviceViewModel(GKDriverType.RSR2_AM_1); var devicesViewModel = GroupControllerModule.DevicesViewModel; var selectedDevice = devicesViewModel.SelectedDevice = devicesViewModel.AllDevices.FirstOrDefault(x => x.Driver.DriverType == GKDriverType.RSR2_KAU_Shleif); devicesViewModel.SelectedDevice.AddCommand.Execute(); ServiceFactory.DialogService = MockDialogService = new MockDialogService(); SetMokForNewDeviceViewModel(GKDriverType.RSR2_AM_4, addInStartList: true); selectedDevice = devicesViewModel.SelectedDevice = devicesViewModel.AllDevices.FirstOrDefault(x => x.Driver.DriverType == GKDriverType.RSR2_KAU_Shleif); devicesViewModel.SelectedDevice.AddCommand.Execute(); Assert.IsTrue(selectedDevice.Device.Children.FirstOrDefault(x => x.DriverType == GKDriverType.RSR2_AM_4).IntAddress == 1); Assert.IsTrue(selectedDevice.Device.Children.LastOrDefault(x => x.DriverType == GKDriverType.RSR2_AM_1).IntAddress == 5); }
public void AddNegativMVP() { SetMokForNewDeviceViewModel(GKDriverType.RSR2_AM_4, 63); var devicesViewModel = GroupControllerModule.DevicesViewModel; var selectedDevice = devicesViewModel.SelectedDevice = devicesViewModel.AllDevices.FirstOrDefault(x => x.Driver.DriverType == GKDriverType.RSR2_KAU_Shleif); devicesViewModel.SelectedDevice.AddCommand.Execute(); Assert.IsTrue(selectedDevice.Device.AllChildren.Max(x => x.IntAddress) == 252); ServiceFactory.DialogService = MockDialogService = new MockDialogService(); SetMokForNewDeviceViewModel(GKDriverType.RSR2_MVP); devicesViewModel.SelectedDevice.AddCommand.Execute(); Assert.IsTrue(selectedDevice.Device.AllChildren.Max(x => x.IntAddress) == 253); ServiceFactory.DialogService = MockDialogService = new MockDialogService(); SetMokForNewDeviceViewModel(GKDriverType.RSR2_AM_4); selectedDevice = devicesViewModel.SelectedDevice = devicesViewModel.AllDevices.FirstOrDefault(x => x.Driver.DriverType == GKDriverType.RSR2_MVP_Part); devicesViewModel.SelectedDevice.AddCommand.Execute(); Assert.IsTrue(selectedDevice.Device.AllChildren.Count == 0); Assert.IsTrue(devicesViewModel.AllDevices.FirstOrDefault(x => x.Driver.DriverType == GKDriverType.RSR2_KAU_Shleif).Device.AllChildren.Max(x => x.IntAddress) == 253); }
public void AddMirrorItem() { SetMokForNewDeviceViewModel(GKDriverType.GKMirror); var devicesViewModel = GroupControllerModule.DevicesViewModel; var selectedDevice = devicesViewModel.SelectedDevice = devicesViewModel.AllDevices.FirstOrDefault(x => x.Driver.DriverType == GKDriverType.GK); devicesViewModel.SelectedDevice.AddCommand.Execute(); ServiceFactory.DialogService = MockDialogService = new MockDialogService(); SetMokForNewDeviceViewModel(GKDriverType.FireZonesMirror, 2); selectedDevice = devicesViewModel.SelectedDevice = devicesViewModel.AllDevices.FirstOrDefault(x => x.Driver.DriverType == GKDriverType.GKMirror); devicesViewModel.SelectedDevice.AddCommand.Execute(); Assert.IsTrue(selectedDevice.Device.Children.Count(x => x.Driver.HasMirror == true) == 2); Assert.IsTrue(selectedDevice.Device.Children.Where(x => x.Driver.HasMirror == true).FirstOrDefault().IntAddress == 1); Assert.IsTrue(selectedDevice.Device.Children.Where(x => x.Driver.HasMirror == true).LastOrDefault().IntAddress == 2); }
public void AddGroupDeviceNegativeValueForRSR2() { SetMokForNewDeviceViewModel(GKDriverType.RSR2_AM_1, 254); var devicesViewModel = GroupControllerModule.DevicesViewModel; var selectedDevice = devicesViewModel.SelectedDevice = devicesViewModel.AllDevices.FirstOrDefault(x => x.Driver.DriverType == GKDriverType.RSR2_KAU_Shleif); devicesViewModel.SelectedDevice.AddCommand.Execute(); ServiceFactory.DialogService = MockDialogService = new MockDialogService(); SetMokForNewDeviceViewModel(GKDriverType.RSR2_AM_2); selectedDevice = devicesViewModel.SelectedDevice = devicesViewModel.AllDevices.FirstOrDefault(x => x.Driver.DriverType == GKDriverType.RSR2_KAU_Shleif); devicesViewModel.SelectedDevice.AddCommand.Execute(); Assert.IsTrue(selectedDevice.Device.AllChildren.Count() == 254); Assert.IsTrue(selectedDevice.Device.Children.Count() == 254); }