예제 #1
0
        public void ShouldTakeDescriptionAttributeDuringConversion()
        {
            object converted = new EnumValueConverter().Convert(EnumTestCase.Two, null, null, null);

              Assert.IsInstanceOfType(converted, typeof(string));
              Assert.AreEqual<string>("description", (string)converted);
        }
예제 #2
0
        public void ShouldReturnNullValueString()
        {
            object converted = new EnumValueConverter().Convert(null, null, null, null);

              Assert.IsInstanceOfType(converted, typeof(string));
              Assert.AreEqual<string>(EnumValueConverter.NullValueString, (string)converted);
        }
예제 #3
0
        public void ShouldConvertNonEnumValueToString()
        {
            object converted = new EnumValueConverter().Convert(1234, null, null, null);

              Assert.IsInstanceOfType(converted, typeof(string));
              Assert.AreEqual<string>("1234", (string)converted);
        }
예제 #4
0
        public void ShouldConvertToStringForEmptyDescriptionAttribute()
        {
            object converted = new EnumValueConverter().Convert(EnumTestCase.Three, null, null, null);

              Assert.IsInstanceOfType(converted, typeof(string));
              Assert.AreEqual<string>("Three", (string)converted);
        }
예제 #5
0
        public void ShoudConvertEnumToString()
        {
            object converted = new EnumValueConverter().Convert(EnumTestCase.One, null, null, null);

              Assert.IsInstanceOfType(converted, typeof(string));
              Assert.AreEqual<string>("One", (string)converted);
        }