Ejemplo n.º 1
0
        public void GetEnumValueAttribute_NoAttribute()
        {
            // Act
            var actual = EnumAttributeHelper.GetEnumValueAttribute <SimpleAttribute>(TestEnum.Value1);

            // Assert
            actual.ShouldHaveSameValueAs(null);
        }
Ejemplo n.º 2
0
        public void GetPropertyValue_String()
        {
            // Act
            var actual = EnumAttributeHelper.GetPropertyValue <TestEnum, SimpleAttribute, string>(TestEnum.Value3, attribute => attribute.MyString);

            // Assert
            actual.ShouldHaveSameValueAs("d");
        }
Ejemplo n.º 3
0
        public void GetEnumFromPropertyValue_ValueGiven()
        {
            // Arrange
            var expected = TestEnum.Value2;

            // Act
            var actual = EnumAttributeHelper.GetEnumFromPropertyValue <TestEnum, SimpleAttribute, int>(3, o => o.MyInt);

            // Assert
            actual.ShouldHaveSameValueAs(expected);
        }
Ejemplo n.º 4
0
        public void GetEnumFromPropertyValue_NullValueGiven()
        {
            // Arrange
            var expected = TestEnum.Value3;

            // Act
            var actual = EnumAttributeHelper.GetEnumFromPropertyValue <TestEnum, SimpleAttribute, string>(null, o => o.MyString);

            // Assert
            actual.ShouldHaveSameValueAs(expected);
        }
Ejemplo n.º 5
0
        public void GetEnumValueAttribute()
        {
            // Arrange
            var expected = new SimpleAttribute {
                MyInt = 1, MyString = "a"
            };

            // Act
            var actual = EnumAttributeHelper.GetEnumValueAttribute <SimpleAttribute>(TestEnum.Value0);

            // Assert
            actual.ShouldHaveSameValueAs(expected);
        }
Ejemplo n.º 6
0
 public void GetEnumFromPropertyValue_NullPropertyExpression()
 {
     // Act
     EnumAttributeHelper.GetEnumFromPropertyValue <TestEnum, SimpleAttribute, int>(1, null);
 }
Ejemplo n.º 7
0
 public void GetEnumValueAttribute_NullValue()
 {
     // Act
     EnumAttributeHelper.GetEnumValueAttribute <SimpleAttribute>(null);
 }
Ejemplo n.º 8
0
 public void GetPropertyValue_String_NoAttributeDefined()
 {
     // Act
     EnumAttributeHelper.GetPropertyValue <TestEnum, SimpleAttribute, string>(TestEnum.Value1, attribute => attribute.MyString);
 }
Ejemplo n.º 9
0
 public void GetPropertyValue_String_NullPropertyExpression()
 {
     // Act
     EnumAttributeHelper.GetPropertyValue <TestEnum, SimpleAttribute, string>(TestEnum.Value3, null);
 }
Ejemplo n.º 10
0
 public void GetPropertyValue_String_NotAnEnum()
 {
     // Act
     EnumAttributeHelper.GetPropertyValue <SimpleStruct, SimpleAttribute, string>(new SimpleStruct(), null);
 }