public void ShouldParseUsingFromValue() { FakeEnumeration temp; FakeEnumeration.FromValue(1).Should().Be(FakeEnumeration.One); FakeEnumeration.TryParse(1, out temp).Should().BeTrue(); }
public void ShouldParseUsingDisplayName() { FakeEnumeration temp; FakeEnumeration.Parse("one").Should().Be(FakeEnumeration.One); FakeEnumeration.TryParse("one", out temp).Should().BeTrue(); }
public void ShouldThrowArgumentExceptionWhenBadValue() { var e = Record.Exception(() => FakeEnumeration.FromValue(-1)); e.Should().BeOfType <ArgumentException>(); e.Message.Should().Contain((-1).ToString()); e.Message.Should().Contain(typeof(FakeEnumeration).FullName); FakeEnumeration.TryParse(-1, out var temp).Should().BeFalse(); }
public void ShouldThrowArgumentExceptionWhenBadDisplayName() { var e = Record.Exception(() => FakeEnumeration.Parse("test")); e.Should().BeOfType <ArgumentException>(); e.Message.Should().Contain(typeof(FakeEnumeration).FullName); e.Message.Should().Contain("test"); FakeEnumeration.TryParse("temp", out var temp).Should().BeFalse(); }