Пример #1
0
        public void ShouldParseUsingDisplayName()
        {
            FakeEnumeration temp;

            FakeEnumeration.Parse("one").Should().Be(FakeEnumeration.One);
            FakeEnumeration.TryParse("one", out temp).Should().BeTrue();
        }
Пример #2
0
        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();
        }