public void Test_GetSlotName_TruncatesSystemName() { const string logicalName = "something"; const string branch = "Main"; const string configuration = "TEST"; var systemName = Guid.NewGuid().ToString(); var expected = string.Concat(systemName.ToLower().Take(DefaultNaming <AzureCloudService> .MaxSystemLength)) + "-" + string.Concat(logicalName.ToLower().Take(DefaultNaming <AzureCloudService> .MaxComponentLength)) + "-" + string.Concat(configuration.ToLower().Take(DefaultNaming <AzureCloudService> .MaxConfigurationLength)); FlexDataConfiguration.RootBranch = branch; var component = new AzureCloudService { LogicalName = logicalName, System = new DevOpsSystem { LogicalName = systemName } }; var namer = new DefaultNaming <AzureCloudService>(); var result = namer.GetSlotName(component, branch, configuration); Assert.AreEqual(expected, result); }
public void Test_GetSlotName_OutsideMainBranch() { const string logicalName = "something"; const string systemName = "tsys"; const string branch = "Release10"; const string configuration = "TEST"; var expected = string.Concat(systemName.ToLower().Take(DefaultNaming<AzureCloudService>.MaxSystemLength)) + "-" + string.Concat(logicalName.ToLower().Take(DefaultNaming<AzureCloudService>.MaxComponentLength)) + "-" + "r1" + string.Concat(configuration.ToLower().Take(DefaultNaming<AzureCloudService>.MaxConfigurationLength)); FlexDataConfiguration.RootBranch = "Main"; var component = new AzureCloudService { LogicalName = logicalName, System = new DevOpsSystem { LogicalName = systemName } }; var namer = new DefaultNaming<AzureCloudService>(); var result = namer.GetSlotName(component, branch, configuration); Assert.AreEqual(expected, result); }