public void GetSettingsViewModel1ModelTest() { var n = "Gireizlä"; var settingsMock = MockHelperBll.GetSettingsBll( new List <Module> { new Module { Name = n } } ); var rolesMock = MockHelperRoles.GetRoles(new List <String>()); var target = new SettingsService(new NLogLoggerFactory()) { SettingsBll = settingsMock, Roles = rolesMock }; var actual = target.GetSettingsViewModel(); var modules = actual.ModuleSettings.ToList(); modules .Count.Should() .Be(1); modules.First() .Name.Should() .Be(n); }
public void GetLaborHomeViewModel2ModelTest() { const String moduleName1 = "Dashboard"; const String moduleName2 = "Input"; var laborhomebllmock = MockHelperBll.GetLaborHomeBll( new List <Module> { new Module { Name = moduleName1 } , new Module { Name = moduleName2 } } ); var rolesMock = MockHelperRoles.GetRoles(new List <String>()); var target = new LaborHomeService(new NLogLoggerFactory()) { LaborHome = laborhomebllmock, Roles = rolesMock }; var actual = target.GetLaborHomeViewModel(); Assert.Equal(2, actual.Modules.Count()); Assert.Equal(moduleName1, actual.Modules.First() .Name); Assert.Equal(moduleName2, actual.Modules.ToList()[1].Name); }
public void AllVisibleMainModulesForRolesEmptyTest() { var navigationBllMock = MockHelperBll.GetNavigationBll( new List <Module>(), new List <Module>() ); var rolesMock = MockHelperRoles.GetRoles(new List <String>()); var target = new NavigationService(new NLogLoggerFactory()) { NavigationBll = navigationBllMock, Roles = rolesMock }; var actual = target.GetNavigationViewModel(); actual.MainModules.ToList() .Count.Should() .Be(0); actual.SettingModules.ToList() .Count.Should() .Be(0); }
public void UpdateModuleSettingIdNotFoundTest() { var n1 = "Changer"; var id1 = 0; var vis = true; var settingsMock = MockHelperBll.GetSettingsBll( new List <Module>(new List <Module> { new Module { Name = "Bla", ModuleId = 66, Visible = true } }) ); var rolesMock = MockHelperRoles.GetRoles(new List <String>()); var target = new SettingsService(new NLogLoggerFactory()) { SettingsBll = settingsMock, Roles = rolesMock }; var actual = target.UpdateModuleSetting(new ModuleSetting { Visible = vis, Name = n1, Id = id1 }); actual.Should() .BeNull("because no modules exist"); }
public void GetHomeViewModelSingleModelTest() { var name = "fancy stuff"; var homebllmock = MockHelperBll.GetHomeBll( new List <Module> { new Module { Name = name } } ); var rolesMock = MockHelperRoles.GetRoles(new List <String>()); var target = new HomeService(new NLogLoggerFactory()) { HomeBll = homebllmock, Roles = rolesMock }; var actual = target.GetHomeViewModel(); actual.Modules.ToList() .Count.Should() .Be(1); actual.Modules.ToList()[0].Name.Should() .Be(name); }
public void UpdateModuleSettingNormal3Test() { var n = "Changer"; var n2 = "Stay"; var id = 0; var id2 = 44; var visbefore = true; var visafter = false; var vis2 = true; var settingsMock = MockHelperBll.GetSettingsBll( new List <Module>(new List <Module> { new Module { Name = n, ModuleId = id, Visible = visbefore }, new Module { Name = n2, ModuleId = id2, Visible = vis2 } }) ); var rolesMock = MockHelperRoles.GetRoles(new List <String>()); var target = new SettingsService(new NLogLoggerFactory()) { SettingsBll = settingsMock, Roles = rolesMock }; var actual = target.UpdateModuleSetting(new ModuleSetting { Visible = visafter, Name = n, Id = id }); actual.Should() .NotBeNull("because model exist"); actual.Visible.Should() .Be(visafter); actual.ModuleId.Should() .Be(id); actual.Name.Should() .Be(n); }
public void GetLaborHomeViewModelEmptyTest() { var laborhomebllmock = MockHelperBll.GetLaborHomeBll( new List <Module>() ); var rolesMock = MockHelperRoles.GetRoles(new List <String>()); var target = new LaborHomeService(new NLogLoggerFactory()) { LaborHome = laborhomebllmock, Roles = rolesMock }; var actual = target.GetLaborHomeViewModel(); Assert.Equal(0, actual.Modules.Count()); }
public void GetSettingsViewModelEmptyTest() { var settingsMock = MockHelperBll.GetSettingsBll( new List <Module>() ); var rolesMock = MockHelperRoles.GetRoles(new List <String>()); var target = new SettingsService(new NLogLoggerFactory()) { SettingsBll = settingsMock, Roles = rolesMock }; var actual = target.GetSettingsViewModel(); actual.ModuleSettings.ToList() .Count.Should() .Be(0); }
public void GetHomeViewModelEmptyTest() { var homebllmock = MockHelperBll.GetHomeBll( new List <Module>() ); var rolesMock = MockHelperRoles.GetRoles(new List <String>()); var target = new HomeService(new NLogLoggerFactory()) { HomeBll = homebllmock, Roles = rolesMock }; var actual = target.GetHomeViewModel(); actual.Modules.ToList() .Count.Should() .Be(0); }
public void GetSettingsViewModel2ModelTest() { var n1 = "TheOne"; var n2 = "TheOnly"; var settingsMock = MockHelperBll.GetSettingsBll( new List <Module> { new Module { Name = n1 }, new Module { Name = n2 } } ); var rolesMock = MockHelperRoles.GetRoles(new List <String>()); var target = new SettingsService(new NLogLoggerFactory()) { SettingsBll = settingsMock, Roles = rolesMock }; var actual = target.GetSettingsViewModel(); var modules = actual.ModuleSettings.ToList(); modules .Count.Should() .Be(2); modules.First() .Name.Should() .Be(n1); modules[1].Name.Should() .Be(n2); }
public void GetHomeViewModel2ModelTest() { var n1 = "TheMightyOne"; var n2 = "TheMightyTwo"; var homebllmock = MockHelperBll.GetHomeBll( new List <Module> { new Module { Name = n1 } , new Module { Name = n2 } } ); var rolesMock = MockHelperRoles.GetRoles(new List <String>()); var target = new HomeService(new NLogLoggerFactory()) { HomeBll = homebllmock, Roles = rolesMock }; var actual = target.GetHomeViewModel(); actual.Modules.ToList() .Count.Should() .Be(2); actual.Modules.ToList()[0].Name.Should() .Be(n1); actual.Modules.ToList()[1].Name.Should() .Be(n2); }
public void AllVisibleMainModulesForRolesNormalTest() { var m1 = "Auf dem Tisch stehen"; var m2 = "Gummibärli esse"; var m3 = "Kaffii trinkä"; var m4 = "So Istellige halt"; var navigationBllMock = MockHelperBll.GetNavigationBll( new List <Module> { new Module { Name = m4, Visible = true } }, new List <Module> { new Module { Name = m1, Visible = true }, new Module { Name = m2, Visible = true }, new Module { Name = m3, Visible = true } } ); var rolesMock = MockHelperRoles.GetRoles(new List <String>()); var target = new NavigationService(new NLogLoggerFactory()) { NavigationBll = navigationBllMock, Roles = rolesMock }; var actual = target.GetNavigationViewModel(); var mainmodules = actual.MainModules.ToList(); mainmodules .Should() .NotBeNull("because there are visible modules"); mainmodules.Count.Should() .Be(3); mainmodules[0].Name.Should() .Be(m1); mainmodules[0].Visible.Should() .BeTrue("because all modules for this method must be visible"); mainmodules[1].Name.Should() .Be(m2); mainmodules[1].Visible.Should() .BeTrue("because all modules for this method must be visible"); mainmodules[2].Name.Should() .Be(m3); mainmodules[2].Visible.Should() .BeTrue("because all modules for this method must be visible"); var settingmodules = actual.SettingModules.ToList(); settingmodules .Should() .NotBeNull("because there is visible setting module"); settingmodules.Count.Should() .Be(1); settingmodules[0].Name.Should() .Be(m4); settingmodules[0].Visible.Should() .BeTrue("because settings module must be true"); }