Example #1
0
        internal static string ToSerializedValue(this AssetDtoValueType value)
        {
            switch (value)
            {
            case AssetDtoValueType.DBConnectionString:
                return("DBConnectionString");

            case AssetDtoValueType.HttpConnectionString:
                return("HttpConnectionString");

            case AssetDtoValueType.Text:
                return("Text");

            case AssetDtoValueType.Bool:
                return("Bool");

            case AssetDtoValueType.Integer:
                return("Integer");

            case AssetDtoValueType.Credential:
                return("Credential");

            case AssetDtoValueType.WindowsCredential:
                return("WindowsCredential");

            case AssetDtoValueType.KeyValueList:
                return("KeyValueList");
            }
            return(null);
        }
        public static void ValidateAssetResponse(ICollection <Asset> assets, long?expectedId, string expectedName, AssetDtoValueType expectedType, string expectedValue)
        {
            Assert.IsNotNull(assets);
            Assert.AreEqual(1, assets.Count);

            var asset = assets.First();

            Assert.AreNotEqual(0, asset.Id);
            if (expectedId.HasValue)
            {
                Assert.AreEqual(expectedId.Value, asset.Id);
            }
            Assert.AreEqual(expectedName, asset.Name);
            Assert.AreEqual(expectedType, asset.ValueType);
            Assert.AreEqual(expectedValue, asset.Value);
        }