private static void AddCustomVariableGroups() { for (int i = 1; i <= TotalNumberOfEachEntityToCreate; i++) { CustomVariableGroup group = new CustomVariableGroup(); group.Name = "group" + i; // For each group, add some custom variables. The first group will have one variable, // the second will have two, and so on... for (int x = 1; x <= i; x++) { group.CustomVariables.Add(new CustomVariable() { Key = "k" + x, Value = "v" + x }); } CustomVariableGroupLogic.Save(group); } // Add a group with the Deleted property set to true. It shouldn't affect the other tests because // getting all the groups should exclude the deleted group. Guid uniqueGroupName = Guid.NewGuid(); CustomVariableGroup deletedGroup = new CustomVariableGroup(); deletedGroup.Name = uniqueGroupName.ToString(); deletedGroup.Deleted = true; CustomVariableGroupLogic.Save(deletedGroup); }
private static void AddAppServers() { IEnumerable <InstallationEnvironment> environments = InstallationEnvironmentLogic.GetAll(); for (int i = 1; i <= TotalNumberOfEachEntityToCreate; i++) { ApplicationServer server = new ApplicationServer(); server.Name = "server" + i; server.InstallationEnvironment = environments.Where(x => x.LogicalOrder == 1).First(); // 1st env is dev server.Description = "Description " + i; server.EnableDebugLogging = false; Application app = ApplicationLogic.GetByName("app" + i); server.ApplicationsWithOverrideGroup.Add(new ApplicationWithOverrideVariableGroup() { Enabled = true, Application = app }); CustomVariableGroup group = CustomVariableGroupLogic.GetByName("group" + i); server.CustomVariableGroups.Add(group); ApplicationServerLogic.Save(server); } }
public void GetByNameTest() { string name = "group8"; CustomVariableGroup group = CustomVariableGroupLogic.GetByName(name); Assert.AreEqual(name, group.Name); }
public CustomVariableGroup SaveGroup(CustomVariableGroup customVariableGroup) { return(Invoke(() => { CustomVariableGroup existingGroup = null; if (!string.IsNullOrWhiteSpace(customVariableGroup.Id)) { existingGroup = CustomVariableGroupLogic.GetById(customVariableGroup.Id); } CustomVariableGroupLogic.Save(customVariableGroup); PossiblySendCustomVariableGroupChangedEmail(existingGroup, customVariableGroup); return customVariableGroup; })); }
internal static CustomVariableGroup CreateCustomVariableGroup(string rootName) { CustomVariableGroup group = new CustomVariableGroup(); group.Name = rootName + " group"; group.CustomVariables.Add(new CustomVariable() { Key = rootName + " key", Value = rootName + " value" }); CustomVariableGroupLogic.Save(group); return(group); }
public void ApplicationShouldBeInstalledTest_UseCase3() { // Use Case #3 -- app group exists in the server's ApplicationWithGroupToForceInstallList // -- with *valid* custom variable group ApplicationServer appServer = GetAppServerWithInstallationSummariesFromDb(); // Use this app ApplicationWithOverrideVariableGroup appWithValidGroup = appServer.ApplicationsWithOverrideGroup[0]; appWithValidGroup.CustomVariableGroups[0] = CustomVariableGroupLogic.GetById("CustomVariableGroups/4"); ApplicationServerLogic.SaveForceInstallation(new ServerForceInstallation(appServer, appWithValidGroup)); SetGlobalFreeze(false); ApplicationServerLogic.InstallApplications(appServer); _mockAppInstaller.Verify(x => x.InstallApplication(It.IsAny <ApplicationServer>(), It.IsAny <ApplicationWithOverrideVariableGroup>()), Times.Once()); }
public void ApplicationShouldBeInstalledTest_UseCase4() { // Use Case #4 -- app group does not exist in the server's ApplicationWithGroupToForceInstallList ApplicationServer appServer = GetAppServerWithInstallationSummariesFromDb(); // Use this app ApplicationWithOverrideVariableGroup appWithValidGroup = appServer.ApplicationsWithOverrideGroup[0]; appWithValidGroup.CustomVariableGroups[0] = CustomVariableGroupLogic.GetById("CustomVariableGroups/4"); SetGlobalFreeze(false); // Note: We are *not* adding our app to the *force install* list of the server. // In other words, there is no force installation. //bool actual = ApplicationServerLogic.ApplicationShouldBeInstalled(appServer, appWithValidGroup); //Assert.AreEqual(false, actual); ApplicationServerLogic.InstallApplications(appServer); _mockAppInstaller.Verify(x => x.InstallApplication(It.IsAny <ApplicationServer>(), It.IsAny <ApplicationWithOverrideVariableGroup>()), Times.Never()); }
public void DeleteGroup(CustomVariableGroup customVariableGroup) { Invoke(() => CustomVariableGroupLogic.Delete(customVariableGroup)); }
public CustomVariableGroup GetCustomVariableGroupByName(string name) { return(Invoke(() => CustomVariableGroupLogic.GetByName(name))); }
public IEnumerable <CustomVariableGroup> GetAllGroups() { return(Invoke(() => CustomVariableGroupLogic.GetAll())); }
CustomVariableGroup ICustomVariableGroupService.GetById(string id) { return(Invoke(() => CustomVariableGroupLogic.GetById(id))); }