private static ExtendableEnumBase <TEnumeration, TValue> Convert <TEnumeration, TValue>(IDictionary <string, object> dictionary)
            where TEnumeration : ExtendableEnumBase <TEnumeration, TValue>
            where TValue : IComparable
        {
            if (dictionary == null)
            {
                throw new ArgumentNullException(nameof(dictionary));
            }

            var     type       = typeof(TValue);
            dynamic typedValue = System.Convert.ChangeType(dictionary["value"], type, CultureInfo.InvariantCulture);

            return(ExtendableEnumBase <TEnumeration, TValue> .ParseValue(typedValue));
        }
Ejemplo n.º 2
0
    public void ConvertToExpandedEnumerationFromValue()
    {
        ExtendableEnumBase <SampleStatus, int> status = SampleStatus.Active.Value;

        Assert.AreEqual(SampleStatus.Active, status);
    }