public void GetDescription_ValueNotDefined_ThrowsException() { //Force a value that isn't defined TestEnum value = (TestEnum)0; string description = DescriptionResolver.GetDescription(value); }
public void TryGetDescription_ValueNotDefined() { //Force a value that isn't defined TestEnum value = (TestEnum)0; string description = DescriptionResolver.TryGetDescription(value); Assert.AreEqual(description, value.ToString()); }
public void GetDescription_TypeIsNotAnEnum_ThrowsException() { //C# won't allow generic parameters to be constrainted to enums //so we have to allow structs. We don't have to be happy about it //though so we'll throw an exception if the supplied type is not //an enum. TestStruct value = new TestStruct(); string description = DescriptionResolver.GetDescription(value); }
public void GetDescription_ValueHasDescription() { string description = DescriptionResolver.GetDescription(TestEnum.Item2); Assert.AreEqual(description, "Second Item"); }
public void GetDescription_ValueDoesNotHaveDescription() { string description = DescriptionResolver.GetDescription(TestEnum.Item1); Assert.AreEqual(description, TestEnum.Item1.ToString()); }
public void GetDescription_ValueNull_ThrowsException() { string description = DescriptionResolver.GetDescription(null); }
public void GetDescription_ValueNull() { string description = DescriptionResolver.TryGetDescription(null); Assert.AreEqual(description, string.Empty); }