Beispiel #1
0
        public void GetStandardValues_ITypeDescriptorContextIsNull_ReturnEnumValues()
        {
            // Setup
            var converter = new NullableEnumConverter(typeof(SimpleEnum?));

            // Call
            TypeConverter.StandardValuesCollection result = converter.GetStandardValues(null);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(2, result.Count);
            Assert.AreEqual(SimpleEnum.FirstValue, result[0]);
            Assert.AreEqual(SimpleEnum.SecondValue, result[1]);
        }
Beispiel #2
0
        public void GetStandardValues_ITypeDescriptorContext_ReturnEnumValues()
        {
            // Setup
            var mockRepository        = new MockRepository();
            var typeDescriptorContext = mockRepository.Stub <ITypeDescriptorContext>();

            mockRepository.ReplayAll();

            var converter = new NullableEnumConverter(typeof(SimpleEnum?));

            // Call
            TypeConverter.StandardValuesCollection result = converter.GetStandardValues(typeDescriptorContext);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(2, result.Count);
            Assert.AreEqual(SimpleEnum.FirstValue, result[0]);
            Assert.AreEqual(SimpleEnum.SecondValue, result[1]);
            mockRepository.VerifyAll();
        }