public void ParsingDefinedEnumValueReturnsEnumValue2(string s) { // Act Fruit fruit = XConvert.ToOrDefault <Fruit>(s); // Assert Assert.AreEqual(Fruit.Apple, fruit); }
public void ParsingUndefinedEnumValueWithNoDefaultThrowsException(string s) { // Assert Assert.IsFalse(Enum.IsDefined(typeof(Fruit), default(Fruit))); // Act Fruit _ = XConvert.ToOrDefault <Fruit>(s); }
public void ParsingUndefinedEnumValueReturnsDefaultValue(string s) { // Act Fruit fruit = XConvert.ToOrDefault <Fruit>(s, Fruit.Banana); // Assert Assert.AreEqual(Fruit.Banana, fruit); }