public void Deserialize_ResourceType_NotSpecified_ReportsError() { // Arrange var node = YamlUtils.CreateYamlNode("resourceType: 'NotSpecified'"); // Act / Assert YamlAssert.ReportsError( _deserializer, node, node["resourceType"], "'resourceType' must not be set to 'NotSpecified'."); }
public void Deserialize_EnvironmentVariableAndRawValueNotSupplied_ReportsError() { // Arrange var node = YamlUtils.CreateYamlNode("name: 123"); // Act / Assert YamlAssert.ReportsError( _deserializer, node, node, "Either 'environmentVariable' or 'rawValue' must be supplied for a secret."); }
public void Deserialize_IntValueInvalid_ReportsError() { // Arrange var node = YamlUtils.CreateYamlNode("age: twenty"); var dayValueNode = node.Children.Single(c => c.Key.ToString() == "age").Value; // Act / Assert YamlAssert.ReportsError( _deserializer, node, dayValueNode, $"'twenty' is not a valid value for 'age'. The value must be of type {typeof(int)}."); }
public void Deserialize_EnumValueInvalid_ReportsError() { // Arrange var node = YamlUtils.CreateYamlNode("day: Sundag"); var dayValueNode = node.Children.Single(c => c.Key.ToString() == "day").Value; // Act / Assert YamlAssert.ReportsError( _deserializer, node, dayValueNode, "'Sundag' is not a valid value for 'day'."); }
public void Deserialize_TimeSpanValueInvalid_ReportsError() { // Arrange var node = YamlUtils.CreateYamlNode("interval: twenty"); var dayValueNode = node.Children.Single(c => c.Key.ToString() == "interval").Value; // Act / Assert YamlAssert.ReportsError( _deserializer, node, dayValueNode, $"'twenty' is not a valid value for 'interval'. The value must be in the format 'hh:mm:ss'."); }
public void Deserialize_CronSyntaxInvalid_ReportsError() { // Arrange var node = YamlUtils.CreateYamlNode("schedule: 12345"); var dayValueNode = node.Children.Single(c => c.Key.ToString() == "schedule").Value; // Act / Assert YamlAssert.ReportsError( _deserializer, node, dayValueNode, "'12345' is not a valid value for 'schedule'. The value must be a valid Cron expression."); }
public void Deserialize_InvalidAzureCloudSupplied_ReportsError() { var yamlNode = YamlUtils.CreateYamlNode( @"azureMetadata: cloud: invalid"); var azureMetadataNode = (YamlMappingNode)yamlNode.Children["azureMetadata"]; var errorNode = azureMetadataNode.Children["cloud"]; YamlAssert.ReportsError( _deserializer, azureMetadataNode, errorNode, "'invalid' is not a valid value for 'cloud'."); }
public void Deserialize_AzureCloudSuppliedWithUnspecified_SetsAzureChinaCloud() { var yamlNode = YamlUtils.CreateYamlNode( $@"azureMetadata: cloud: '{AzureCloud.Unspecified}'"); var azureMetadataNode = (YamlMappingNode)yamlNode.Children["azureMetadata"]; var errorNode = azureMetadataNode.Children["cloud"]; YamlAssert.ReportsError( _deserializer, azureMetadataNode, errorNode, "'Unspecified' is not a supported value for 'cloud'."); }
public void Deserialize_NoDeserializerForResourceType_ReportsError() { // Arrange const string yamlText = @"resourceType: Generic resources: - resourceUri: Microsoft.ServiceBus/namespaces/promitor-messaging - resourceUri: Microsoft.ServiceBus/namespaces/promitor-messaging-2"; var node = YamlUtils.CreateYamlNode(yamlText); _resourceDeserializerFactory.Setup( f => f.GetDeserializerFor(It.IsAny <ResourceType>())).Returns((IDeserializer <AzureResourceDefinitionV1>)null); // Act / Assert YamlAssert.ReportsError( _deserializer, node, node.Children["resourceType"], "Could not find a deserializer for resource type 'Generic'."); }