public void ContextSetup()
            {
                var masterModel = new MasterModel();

                masterModel.CreateProject(); //1
                masterModel.CreateProject(); //2
                masterModel.CreateProject(); //3
                masterModel.CreateProject(); //4
                masterModel.CreateProject(); //5

                masterModel.AddUnassignedLight(new Light(new ZWaveValueIdentity(1, 22, 123)));

                var statusProvider = S <ISystemStatusProvider>();

                statusProvider.Stub(x => x.GetSystemStatus())
                .Return(masterModel);

                var mapper = S <IMapper>();

                mapper.Stub(x => x.Map <Project[], AdminProjectViewModel[]>(masterModel.Projects))
                .Return(new AdminProjectViewModel[3]);
                mapper.Stub(x => x.Map <Light[], AdminLightViewModel[]>(masterModel.UnassignedLights))
                .IgnoreArguments()
                .Return(new[] { new AdminLightViewModel {
                                    ZWaveIdentity = new ZWaveValueIdentity(1, 22, 444)
                                } });

                var provider = new AdminViewModelProvider(statusProvider, mapper, null);

                _result = provider.GetIndexViewModel();
            }
            public void ContextSetup()
            {
                var masterModel = new MasterModel();

                _project1 = masterModel.CreateProject(); //1
                _project2 = masterModel.CreateProject(); //2

                var server1 = masterModel.CreateCruiseServer(x =>
                {
                    x.Url  = "http://www.example.com/1";
                    x.Name = "1";
                });
                var server2 = masterModel.CreateCruiseServer(x =>
                {
                    x.Url  = "http://www.example.com/2";
                    x.Name = "2";
                });

                var statusProvider = S <ISystemStatusProvider>();

                statusProvider.Stub(x => x.GetSystemStatus())
                .Return(masterModel);

                var cruiseProjectProvider = S <ICruiseProjectModelProvider>();
                var projectResponse1      = NetworkResponse.Success(new CcProjectCollectionViewModel
                {
                    Items = new[] { new CcProjectViewModel {
                                        Name = "1.1"
                                    }, new CcProjectViewModel {
                                        Name = "1.2"
                                    } }
                });
                var projectResponse2 = NetworkResponse.Success(new CcProjectCollectionViewModel
                {
                    Items = new[] { new CcProjectViewModel {
                                        Name = "2.1"
                                    }, new CcProjectViewModel {
                                        Name = "2.2"
                                    } }
                });

                cruiseProjectProvider.Stub(x => x.GetProjects(server1.Id)).Return(projectResponse1);
                cruiseProjectProvider.Stub(x => x.GetProjects(server2.Id)).Return(projectResponse2);

                var mapper = new StubMapper()
                             .StubResult(new[]
                {
                    new EditProjectCruiseServerViewModel {
                        Url = "Mapped 1", Id = server1.Id
                    },
                    new EditProjectCruiseServerViewModel {
                        Url = "Mapped 2", Id = server2.Id
                    }
                });
                var provider = new AdminViewModelProvider(statusProvider, mapper, cruiseProjectProvider);

                _result = provider.GetEditProjectViewModel(null);
            }
            public void ContextSetup()
            {
                var existingMasterModel = new MasterModel();

                _serverId = Guid.NewGuid();
                var existingCruiseProjectAssociations = new[]
                {
                    new CruiseProjectAssociation {
                        ServerId = _serverId, Name = "Project Foo"
                    },
                    new CruiseProjectAssociation {
                        ServerId = _serverId, Name = "Project Bar"
                    },
                    new CruiseProjectAssociation {
                        ServerId = _serverId, Name = "Project To Remove"
                    }
                };
                var projectToEdit = existingMasterModel.CreateProject(x =>
                {
                    x.Name = "Existing Project";
                    x.CruiseProjectAssociations = existingCruiseProjectAssociations;
                });

                _expectedId = projectToEdit.Id;
                existingMasterModel.CreateProject(x => x.Name = "Existing Project 2");
                existingMasterModel.CreateProject(x => x.Name = "Existing Project 3");

                var repository = new StubMasterModelRepository();

                repository.UseCurrentModel(existingMasterModel);

                var manager   = new ProjectManager(repository);
                var editModel = new EditProject
                {
                    ProjectId      = projectToEdit.Id,
                    Name           = "Existing Project",
                    CruiseProjects = new[]
                    {
                        new EditProjectCruiseProject {
                            Server = _serverId, Project = "Project Foo"
                        },
                        new EditProjectCruiseProject {
                            Server = _serverId, Project = "Project Bar"
                        },
                        new EditProjectCruiseProject {
                            Server = _serverId, Project = "Project New"
                        },
                    }
                };

                _result = manager.Update(editModel);

                _savedModel = repository.LastSaved;
            }
Example #4
0
            public void ContextSetup()
            {
                _masterModel = new MasterModel();
                var notDeleted = _masterModel.CreateProject(x => x.Name = "Not Deleted");

                notDeleted.CreateGroup().AddLight(new Light(new ZWaveValueIdentity(1, 11, 123))).AddLight(new Light(new ZWaveValueIdentity(1, 12, 123)));
                notDeleted.CreateGroup().AddLight(new Light(new ZWaveValueIdentity(1, 13, 123))).AddLight(new Light(new ZWaveValueIdentity(1, 14, 123)));
                var toBeDeleted = _masterModel.CreateProject(x => x.Name = "To Be Deleted");

                toBeDeleted.CreateGroup().AddLight(new Light(new ZWaveValueIdentity(1, 21, 123))).AddLight(new Light(new ZWaveValueIdentity(1, 22, 123)));
                toBeDeleted.CreateGroup().AddLight(new Light(new ZWaveValueIdentity(1, 23, 123))).AddLight(new Light(new ZWaveValueIdentity(1, 24, 123)));

                _masterModel.RemoveProject(toBeDeleted.Id);
            }
Example #5
0
            public void ContextSetup()
            {
                var model = new MasterModel();

                _fooGroup = model.CreateProject().CreateGroup();
                _barGroup = model.CreateProject().CreateGroup();

                var zWaveIdentity = new ZWaveValueIdentity(1, 2, 123);

                _light = new Light(zWaveIdentity);
                _fooGroup.AddLight(_light);

                model.AssignLightToGroup(zWaveIdentity, _barGroup.Id);
            }
Example #6
0
            public void Should_find_a_light_by_homeId_and_nodeId_and_valueId()
            {
                var model = new MasterModel();

                var project1 = model.CreateProject(x => x.Name = "1");

                var group1_1   = project1.CreateGroup(x => x.Name = "1.1");
                var light1_1_1 = group1_1.AddLight(new Light(new ZWaveValueIdentity(11, 1, 123)));
                var light1_1_2 = group1_1.AddLight(new Light(new ZWaveValueIdentity(11, 2, 123)));
                var light1_1_3 = group1_1.AddLight(new Light(new ZWaveValueIdentity(11, 3, 123)));

                var group1_2   = project1.CreateGroup(x => x.Name = "1.2");
                var light1_2_1 = group1_2.AddLight(new Light(new ZWaveValueIdentity(12, 1, 123)));
                var light1_2_2 = group1_2.AddLight(new Light(new ZWaveValueIdentity(12, 2, 123)));
                var light1_2_3 = group1_2.AddLight(new Light(new ZWaveValueIdentity(12, 3, 123)));

                var group1_3   = project1.CreateGroup(x => x.Name = "1.3");
                var light1_3_1 = group1_3.AddLight(new Light(new ZWaveValueIdentity(13, 1, 123)));
                var light1_3_2 = group1_3.AddLight(new Light(new ZWaveValueIdentity(13, 2, 123)));
                var light1_3_3 = group1_3.AddLight(new Light(new ZWaveValueIdentity(13, 3, 123)));

                var project2 = model.CreateProject(x => x.Name = "1");

                var group2_1   = project2.CreateGroup(x => x.Name = "2.1");
                var light2_1_1 = group2_1.AddLight(new Light(new ZWaveValueIdentity(21, 1, 123)));
                var light2_1_2 = group2_1.AddLight(new Light(new ZWaveValueIdentity(21, 2, 123)));
                var light2_1_3 = group2_1.AddLight(new Light(new ZWaveValueIdentity(21, 3, 123)));

                var group2_2   = project2.CreateGroup(x => x.Name = "2.2");
                var light2_2_1 = group2_2.AddLight(new Light(new ZWaveValueIdentity(22, 1, 123)));

                _expectedIdentity = new ZWaveValueIdentity(22, 2, 111);
                var light2_2_2   = group2_2.AddLight(new Light(_expectedIdentity));
                var light2_2_2_2 = group2_2.AddLight(new Light(new ZWaveValueIdentity(22, 2, 222)));
                var light2_2_3   = group2_2.AddLight(new Light(new ZWaveValueIdentity(22, 3, 123)));

                var group2_3   = project2.CreateGroup(x => x.Name = "2.3");
                var light2_3_1 = group2_3.AddLight(new Light(new ZWaveValueIdentity(23, 1, 123)));
                var light2_3_2 = group2_3.AddLight(new Light(new ZWaveValueIdentity(23, 2, 123)));
                var light2_3_3 = group2_3.AddLight(new Light(new ZWaveValueIdentity(23, 3, 123)));


                var found = model.FindLight(_expectedIdentity);

                found.ZWaveIdentity.ShouldEqual(_expectedIdentity);
                found.ParentGroup.ShouldBeSameAs(group2_2);
                found.ParentGroup.ParentProject.ShouldBeSameAs(project2);
            }
            public void ContextSetup()
            {
                _serverId1 = Guid.NewGuid();
                _serverId2 = Guid.NewGuid();
                var existingMasterModel = new MasterModel();

                existingMasterModel.CreateProject(x => x.Name = "Existing Project");
                var cruiseProjects = new[]
                {
                    new EditProjectCruiseProject {
                        Server = _serverId1, Project = "Project 1.1"
                    },
                    new EditProjectCruiseProject {
                        Server = _serverId1, Project = "Project 1.2"
                    },
                    new EditProjectCruiseProject {
                        Server = _serverId2, Project = "Project 2.1"
                    },
                    new EditProjectCruiseProject {
                        Server = _serverId2, Project = "Project 2.2"
                    }
                };

                var repository = new StubMasterModelRepository();

                repository.UseCurrentModel(existingMasterModel);

                var creator = new ProjectManager(repository);

                _result = creator.Create(new EditProject {
                    Name = "My New Project", CruiseProjects = cruiseProjects
                });

                _savedModel = repository.LastSaved;
            }
            public void ContextSetup()
            {
                _masterModel = new MasterModel();
                var cruiseServer = _masterModel.CreateCruiseServer(x =>
                {
                    x.Url  = "https://example.com/server1";
                    x.Name = "Server 1";
                });

                _zBuildLightsProject = _masterModel.CreateProject();
                _zBuildLightsProject.CruiseProjectAssociations = new[]
                {
                    new CruiseProjectAssociation {
                        Name = "Project 1.1", ServerId = cruiseServer.Id
                    },
                    new CruiseProjectAssociation {
                        Name = "Project 1.2", ServerId = cruiseServer.Id
                    }
                };

                var cruiseReader = new StubCcReader()
                                   .WithResponse(cruiseServer.Url,
                                                 NetworkResponse.Fail <Projects>("Could not reach server or something bad happened."));

                var updater = new ProjectStatusUpdater(cruiseReader);

                updater.UpdateAllProjectStatuses(_masterModel);
            }
Example #9
0
 public void ContextSetup()
 {
     _id          = Guid.NewGuid();
     _masterModel = new MasterModel();
     _project     = _masterModel.CreateProject();
     _group       = _project.CreateGroup(x => x.Id = _id);
 }
Example #10
0
            public void Should_find_a_group_by_Id()
            {
                var model = new MasterModel();

                var project1 = model.CreateProject(x => x.Name = "1");
                var group1_1 = project1.CreateGroup(x => x.Name = "1.1");
                var group1_2 = project1.CreateGroup(x => x.Name = "1.2");
                var group1_3 = project1.CreateGroup(x => x.Name = "1.3");

                var project2 = model.CreateProject(x => x.Name = "1");
                var group2_1 = project2.CreateGroup(x => x.Name = "2.1");
                var group2_2 = project2.CreateGroup(x => x.Name = "2.2");
                var group2_3 = project2.CreateGroup(x => x.Name = "2.3");

                var found = model.FindGroup(group2_2.Id);
            }
Example #11
0
            public void ContextSetup()
            {
                var groupId = Guid.NewGuid();

                _masterModel = new MasterModel();
                var project = _masterModel.CreateProject(x => x.Name = "Existing Project");

                project.CreateGroup(x => x.Id = groupId)
                .AddLight(new Light(new ZWaveValueIdentity(1, 11, 123)))
                .AddLight(new Light(new ZWaveValueIdentity(1, 12, 123)));

                _zWaveIdentity = new ZWaveValueIdentity(1, 14, 123);
                var unassignedLights = new[]
                {
                    new Light(new ZWaveValueIdentity(1, 51, 123)),
                    new Light(_zWaveIdentity),
                    new Light(new ZWaveValueIdentity(1, 53, 123))
                };

                _masterModel.AddUnassignedLights(unassignedLights);

                var repository = S <IMasterModelRepository>();

                repository.Stub(x => x.GetCurrent()).Return(_masterModel);

                var updater = new LightModelUpdater(repository);

                updater.Update(_zWaveIdentity, groupId, LightColor.Red.Value);
            }
Example #12
0
            public void ContextSetup()
            {
                _destinationGroupId = Guid.NewGuid();
                _zWaveIdentity      = new ZWaveValueIdentity(1, 14, 123);

                var existingMasterModel = new MasterModel();
                var project             = existingMasterModel.CreateProject(x => x.Name = "Existing Project");

                project.CreateGroup(x => x.Id = _destinationGroupId)
                .AddLight(new Light(new ZWaveValueIdentity(1, 11, 123)))
                .AddLight(new Light(new ZWaveValueIdentity(1, 12, 123)));
                project.CreateGroup()
                .AddLight(new Light(new ZWaveValueIdentity(1, 13, 123)))
                .AddLight(new Light(_zWaveIdentity));

                project.CreateGroup()
                .AddLight(new Light(new ZWaveValueIdentity(1, 15, 123)))
                .AddLight(new Light(new ZWaveValueIdentity(1, 16, 123)));

                project.CreateGroup()
                .AddLight(new Light(new ZWaveValueIdentity(2, 13, 123)))
                .AddLight(new Light(new ZWaveValueIdentity(2, 14, 123)));

                var project2 = existingMasterModel.CreateProject(x => x.Name = "Existing Project 2");

                project2.CreateGroup()
                .AddLight(new Light(new ZWaveValueIdentity(1, 21, 123)))
                .AddLight(new Light(new ZWaveValueIdentity(1, 22, 123)));

                var project3 = existingMasterModel.CreateProject(x => x.Name = "Existing Project 3");

                project3.CreateGroup()
                .AddLight(new Light(new ZWaveValueIdentity(1, 31, 123)))
                .AddLight(new Light(new ZWaveValueIdentity(1, 32, 123)));


                var repository = new StubMasterModelRepository();

                repository.UseCurrentModel(existingMasterModel);

                var updater = new LightModelUpdater(repository);

                updater.Update(_zWaveIdentity, _destinationGroupId, LightColor.Red.Value);

                _saved = repository.LastSaved;
            }
            public void ContextSetup()
            {
                var existingMasterModel = new MasterModel();

                existingMasterModel.CreateProject(x => x.Name = "Existing Project");
                existingMasterModel.CreateProject(x => x.Name = "Existing Project 2");
                existingMasterModel.CreateProject(x => x.Name = "Existing Project 3");

                _repository = new StubMasterModelRepository();
                _repository.UseCurrentModel(existingMasterModel);

                var manager = new ProjectManager(_repository);

                _result = manager.Delete(_deleteId);

                _savedModel = _repository.LastSaved;
            }
Example #14
0
            public void ContextSetup()
            {
                _masterModel = new MasterModel();
                _group       = _masterModel.CreateProject().CreateGroup();
                _group.AddLight(new Light(new ZWaveValueIdentity(11, 22, 123)));
                _group.AddLight(new Light(new ZWaveValueIdentity(11, 44, 123)));

                _group.UnassignAllLights();
            }
            public void ContextSetup()
            {
                var existingMasterModel = new MasterModel();

                existingMasterModel.CreateProject(x => x.Name = "Existing Project");
                var projectToEdit = existingMasterModel.CreateProject(x => x.Name = "Keep This");

                existingMasterModel.CreateProject(x => x.Name = "Existing Project 3");

                var repository = new StubMasterModelRepository();

                repository.UseCurrentModel(existingMasterModel);

                var creator = new ProjectManager(repository);

                _result = creator.Update(new EditProject {
                    ProjectId = projectToEdit.Id, Name = "Keep This"
                });
            }
            public void ContextSetup()
            {
                var existingMasterModel = new MasterModel();

                existingMasterModel.CreateProject(x => x.Name = "Existing Project");
                existingMasterModel.CreateProject(x => x.Name = "Existing Project 2");
                existingMasterModel.CreateProject(x => x.Name = "Existing Project 3");

                _repository = new StubMasterModelRepository();
                _repository.UseCurrentModel(existingMasterModel);

                var manager = new ProjectManager(_repository);

                _result = manager.Update(new EditProject {
                    ProjectId = _deleteId, Name = "Value doesn't matter"
                });

                _savedModel = _repository.LastSaved;
            }
Example #17
0
            public void ContextSetup()
            {
                var masterModel = new MasterModel();
                var fooDaddy    = masterModel.CreateProject(x => x.Name = "FooDaddy");

                _group = fooDaddy.CreateGroup(x => x.Name = "Foo");
                _light = new Light(new ZWaveValueIdentity(1, 2, 123));
                _group.AddLight(_light);

                _light.Unassign();
            }
Example #18
0
            public void ContextSetup()
            {
                var zWaveIdentity = new ZWaveValueIdentity(11, 23, 222);

                _light            = new Light(zWaveIdentity);
                _model            = new MasterModel();
                _destinationGroup = _model.CreateProject().CreateGroup();

                _model.AddUnassignedLight(_light);

                _model.AssignLightToGroup(zWaveIdentity, _destinationGroup.Id);
            }
Example #19
0
            public void ContextSetup()
            {
                var masterModel = new MasterModel();
                var fooDaddy    = masterModel.CreateProject(x => x.Name = "FooDaddy");
                var group       = fooDaddy.CreateGroup(x => x.Name = "Foo");
                var light       = new Light(new ZWaveValueIdentity(1, 2, 123));

                group.AddLight(light);

                var barDaddy = masterModel.CreateProject(x => x.Name = "BarDaddy");
                var newGroup = barDaddy.CreateGroup(x => x.Name = "Bar");

                try
                {
                    newGroup.AddLight(light);
                }
                catch (Exception e)
                {
                    _thrown = e;
                }
            }
            public void ContextSetup()
            {
                _masterModel = new MasterModel();
                var cruiseServer = _masterModel.CreateCruiseServer(x =>
                {
                    x.Url  = "https://example.com/server1";
                    x.Name = "Server 1";
                });

                _zBuildLightsProject = _masterModel.CreateProject();
                _zBuildLightsProject.CruiseProjectAssociations = new[]
                {
                    new CruiseProjectAssociation {
                        Name = "Project 1.1", ServerId = cruiseServer.Id
                    },
                    new CruiseProjectAssociation {
                        Name = "Project 1.2", ServerId = cruiseServer.Id
                    },
                    new CruiseProjectAssociation {
                        Name = "Project 1.3", ServerId = cruiseServer.Id
                    }
                };

                var ccReaderDataServer1 = new Projects
                {
                    Items = new ProjectsProject[]
                    {
                        New.ProjectsProject.Name("Project 1.1")
                        .Activity(CcBuildActivity.Sleeping)
                        .Status(CcBuildStatus.Unknown),
                        New.ProjectsProject.Name("Project 1.2")
                        .Activity(CcBuildActivity.Sleeping)
                        .Status(CcBuildStatus.Success),
                        New.ProjectsProject.Name("Project 1.3")
                        .Activity(CcBuildActivity.Sleeping)
                        .Status(CcBuildStatus.Success),
                        New.ProjectsProject.Name("Detractor")
                        .Activity(CcBuildActivity.Sleeping)
                        .Status(CcBuildStatus.Success)
                    }
                };

                var cruiseReader = new StubCcReader()
                                   .WithResponse(cruiseServer.Url, NetworkResponse.Success(ccReaderDataServer1));

                var updater = new ProjectStatusUpdater(cruiseReader);

                updater.UpdateAllProjectStatuses(_masterModel);
            }
Example #21
0
            public void ContextSetup()
            {
                var masterModel = new MasterModel();
                var barDaddy    = masterModel.CreateProject(x => { x.Name = "BarDaddy"; });

                _bar = barDaddy.CreateGroup(x => x.Name = "Bar");

                var fooDaddy = masterModel.CreateProject(x => { x.Name = "FooDaddy"; });
                var foo      = fooDaddy.CreateGroup(x => x.Name = "Foo");

                _light = new Light(new ZWaveValueIdentity(1, 2, 123));


                _bar.AddLight(_light);

                try
                {
                    foo.RemoveLight(_light);
                }
                catch (Exception e)
                {
                    _thrown = e;
                }
            }
Example #22
0
            public void ContextSetup()
            {
                var existingMasterModel = new MasterModel();

                var project       = existingMasterModel.CreateProject(x => x.Name = "Existing Project");
                var existingGroup = project.CreateGroup(x => x.Name = "Existing Group");

                var repository = new StubMasterModelRepository();

                repository.UseCurrentModel(existingMasterModel);

                var creator = new LightGroupManager(repository);

                _result = creator.Update(existingGroup.Id, "Existing Group");

                _savedModel = repository.LastSaved;
            }
Example #23
0
            public void ContextSetup()
            {
                var model = new MasterModel();
                var group = model.CreateProject().CreateGroup();

                _identity1 = new ZWaveValueIdentity(1, 11, 123);
                _identity2 = new ZWaveValueIdentity(2, 22, 123);
                _identity3 = new ZWaveValueIdentity(3, 33, 123);
                _identity4 = new ZWaveValueIdentity(4, 44, 123);

                group
                .AddLight(new Light(_identity1))
                .AddLight(new Light(_identity2));
                model.AddUnassignedLights(new[] { new Light(_identity3), new Light(_identity4) });

                _result = model.AllLights;
            }
            public void ContextSetup()
            {
                var existingMasterModel = new MasterModel();

                existingMasterModel.CreateProject(x => x.Name = "Existing Project");

                var repository = new StubMasterModelRepository();

                repository.UseCurrentModel(existingMasterModel);

                var creator = new ProjectManager(repository);

                _result = creator.Create(new EditProject {
                    Name = "Existing Project"
                });

                _savedModel = repository.LastSaved;
            }
Example #25
0
            public void ContextSetup()
            {
                var groupId = Guid.NewGuid();

                var _masterModel = new MasterModel();
                var project      = _masterModel.CreateProject(x => x.Name = "Existing Project");

                project.CreateGroup(x => x.Id = groupId);

                var repository = S <IMasterModelRepository>();

                repository.Stub(x => x.GetCurrent()).Return(_masterModel);

                var updater = new LightModelUpdater(repository);

                _thrown = ExpectException <InvalidOperationException>(
                    () => updater.Update(new ZWaveValueIdentity(12, 42, 444), groupId, LightColor.Red.Value));
            }
Example #26
0
            public void ContextSetup()
            {
                var existingMasterModel = new MasterModel();
                var parentProject       = existingMasterModel.CreateProject(x => x.Name = "Existing Project");
                var existingGroup       = parentProject.CreateGroup(x => x.Name = "Existing Group");

                _idDoesNotExist = Guid.NewGuid();

                var repository = new StubMasterModelRepository();

                repository.UseCurrentModel(existingMasterModel);

                var creator = new LightGroupManager(repository);

                _result = creator.Delete(_idDoesNotExist);

                _savedModel = repository.LastSaved;
            }
            public void ContextSetup()
            {
                var repo = S <IMasterModelRepository>();

                _model = new MasterModel();
                var group = _model.CreateProject().CreateGroup();

                _identityForOffSwitch = new ZWaveValueIdentity(3, 11, 123);
                group.AddLight(new Light(_identityForOffSwitch));
                group.AddLight(new Light(new ZWaveValueIdentity(3, 22, 123)));
                group.AddLight(new Light(new ZWaveValueIdentity(3, 33, 123)));
                group.AddLight(new Light(new ZWaveValueIdentity(3, 44, 123)));
                repo.Stub(x => x.GetCurrent()).Return(_model);

                _setModelStatusFromNetworkSwitches = new StubSetModelStatusFromNetworkSwitches().DefaultStatus(SwitchState.On).StubStatus(_identityForOffSwitch, SwitchState.Off);

                var statusProvider = new SystemStatusProvider(repo, _setModelStatusFromNetworkSwitches);

                _result = statusProvider.GetSystemStatus();
            }
Example #28
0
        public MasterModel ToDomainObject()
        {
            var masterModel = new MasterModel
            {
                LastUpdatedDate = LastUpdatedDate,
            };

            foreach (var jsonProject in Projects)
            {
                masterModel.CreateProject(jsonProject.InitializeDomainObject());
            }
            foreach (var jsonCruiseServer in CruiseServers)
            {
                masterModel.CreateCruiseServer(jsonCruiseServer.InitializeDomainObject());
            }

            var unassignedLights = UnassignedLights ?? new JsonLight[0];

            masterModel.AddUnassignedLights(unassignedLights.Select(x => x.ToDomainObject()));
            return(masterModel);
        }
Example #29
0
            public void ContextSetup()
            {
                var masterModel = new MasterModel();
                var project     = masterModel.CreateProject(x => x.Name = "Existing Project");

                var zWaveIdentity = new ZWaveValueIdentity(1, 11, 5555);

                project.CreateGroup().AddLight(new Light(zWaveIdentity)
                {
                    Color = LightColor.Yellow
                });

                var repository = new StubMasterModelRepository();

                repository.UseCurrentModel(masterModel);

                var updater = new LightModelUpdater(repository);

                updater.Update(zWaveIdentity, Guid.Empty, LightColor.Red.Value);

                _lastSaved = repository.LastSaved;
            }
Example #30
0
            public void ContextSetup()
            {
                var existingMasterModel = new MasterModel();

                _parentProject = existingMasterModel.CreateProject(x => x.Name = "Existing Project");
                var existingGroup = _parentProject.CreateGroup(x => x.Name = "Existing Group");

                existingGroup.AddLight(new Light(new ZWaveValueIdentity(1, 1, 123)));
                existingGroup.AddLight(new Light(new ZWaveValueIdentity(1, 2, 123)));
                _remainingGroup = _parentProject.CreateGroup();
                _remainingGroup.AddLight(new Light(new ZWaveValueIdentity(1, 10, 123)));

                var repository = new StubMasterModelRepository();

                repository.UseCurrentModel(existingMasterModel);

                var creator = new LightGroupManager(repository);

                _result = creator.Delete(existingGroup.Id);

                _savedModel = repository.LastSaved;
            }