private static object[] SortServiceTypes(object[] serviceTypes) { return(serviceTypes.OrderBy(manifestServiceType => { ServiceTypeType serviceType = manifestServiceType as ServiceTypeType; if (serviceType != null) { return serviceType.ServiceTypeName; } else { return ((ServiceGroupTypeType)manifestServiceType).ServiceGroupTypeName; } }).ToArray()); }
private void TestServiceManifestPlacementConstraints(string expression, bool expectSuccess) { BuildLayoutInfo buildLayoutInfo = new BuildLayoutInfo(this.imageStore); ServiceTypeType sericeType = buildLayoutInfo.ServiceManifestTypes[0].ServiceTypes.First() as ServiceTypeType; Verify.IsNotNull(sericeType); sericeType.PlacementConstraints = expression; string buildPath = buildLayoutInfo.CreateBuildLayout(); ImageBuilderExeTestWrapper exeWrapper = new ImageBuilderExeTestWrapper(this.imageStore); int exitCode = exeWrapper.GetApplicationType(buildPath); Verify.AreEqual(exitCode, expectSuccess ? 0 : ImageBuilderExeTestWrapper.ImageBuilderErrorCode); }
public EvaluationResult <Tag> Parse(string value) { ServiceTypeType serviceTypeType = GetServiceTypeType(value); ServiceType serviceType = new ServiceType(value, serviceTypeType); if (serviceTypeType == ServiceTypeType.Unknown) { EvaluationError error = new EvaluationError(Id, EvaluationErrorType.Error, string.Format(DKimEvaluatorParsersResources.InvalidServiceTypeErrorMessage, value ?? "null"), string.Format(DKimEvaluatorParsersMarkdownResources.InvalidServiceTypeErrorMessage, value ?? "null")); return(new EvaluationResult <Tag>(serviceType, error)); } return(new EvaluationResult <Tag>(serviceType)); }
public void ServiceTypeParserStrategy(string tokenValue, ServiceTypeType serviceTypeType, string errorMessageStartsWith, EvaluationErrorType?errorType) { ServiceTypeParserStrategy serviceTypeParserStrategy = new ServiceTypeParserStrategy(); EvaluationResult <Tag> serviceTypeResult = serviceTypeParserStrategy.Parse(tokenValue); ServiceType serviceType = (ServiceType)serviceTypeResult.Item; if (errorMessageStartsWith == null) { Assert.That(serviceTypeResult.Errors, Is.Empty); Assert.That(serviceType.Value, Is.EqualTo(tokenValue)); Assert.That(serviceType.Type, Is.EqualTo(serviceTypeType)); } else { Assert.That(serviceTypeResult.Errors.Count, Is.EqualTo(1)); Assert.That(serviceTypeResult.Errors[0].Message.StartsWith(errorMessageStartsWith), Is.EqualTo(true)); Assert.That(serviceTypeResult.Errors[0].ErrorType, Is.EqualTo(errorType)); Assert.That(serviceType.Value, Is.EqualTo(tokenValue)); Assert.That(serviceType.Type, Is.EqualTo(serviceTypeType)); } }
bool IsImplicitServiceType(ServiceTypeType serviceTypeType) { return ((serviceTypeType is StatelessServiceTypeType && ((StatelessServiceTypeType)serviceTypeType).UseImplicitHost) || (serviceTypeType is StatefulServiceTypeType && ((StatefulServiceTypeType)serviceTypeType).UseImplicitHost)); }
public ServiceType(string value, ServiceTypeType type, bool isImplicit = false) : base(value, isImplicit) { Type = type; }