public void GetEnumValueAttribute_NoAttribute() { // Act var actual = EnumAttributeHelper.GetEnumValueAttribute <SimpleAttribute>(TestEnum.Value1); // Assert actual.ShouldHaveSameValueAs(null); }
public void GetPropertyValue_String() { // Act var actual = EnumAttributeHelper.GetPropertyValue <TestEnum, SimpleAttribute, string>(TestEnum.Value3, attribute => attribute.MyString); // Assert actual.ShouldHaveSameValueAs("d"); }
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); }
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); }
public void GetEnumValueAttribute() { // Arrange var expected = new SimpleAttribute { MyInt = 1, MyString = "a" }; // Act var actual = EnumAttributeHelper.GetEnumValueAttribute <SimpleAttribute>(TestEnum.Value0); // Assert actual.ShouldHaveSameValueAs(expected); }
public void GetEnumFromPropertyValue_NullPropertyExpression() { // Act EnumAttributeHelper.GetEnumFromPropertyValue <TestEnum, SimpleAttribute, int>(1, null); }
public void GetEnumValueAttribute_NullValue() { // Act EnumAttributeHelper.GetEnumValueAttribute <SimpleAttribute>(null); }
public void GetPropertyValue_String_NoAttributeDefined() { // Act EnumAttributeHelper.GetPropertyValue <TestEnum, SimpleAttribute, string>(TestEnum.Value1, attribute => attribute.MyString); }
public void GetPropertyValue_String_NullPropertyExpression() { // Act EnumAttributeHelper.GetPropertyValue <TestEnum, SimpleAttribute, string>(TestEnum.Value3, null); }
public void GetPropertyValue_String_NotAnEnum() { // Act EnumAttributeHelper.GetPropertyValue <SimpleStruct, SimpleAttribute, string>(new SimpleStruct(), null); }