Пример #1
0
        public void ShouldReturnLanguageVersion()
        {
            var target = new LanguageVersionInput {
                SuppliedInput = "CSharp9"
            };

            var result = target.Validate();

            result.ShouldBe(LanguageVersion.CSharp9);
        }
Пример #2
0
        public void ShouldValidateLanguageVersion()
        {
            var target = new LanguageVersionInput {
                SuppliedInput = "gibberish"
            };

            var ex = Should.Throw <InputException>(() => target.Validate());

            ex.Message.ShouldBe($"The given c# language version (gibberish) is invalid. Valid options are: [{string.Join(", ", ((IEnumerable<LanguageVersion>)Enum.GetValues(typeof(LanguageVersion))).Where(l => l != LanguageVersion.CSharp1))}]");
        }
Пример #3
0
        public void ShouldHaveDefault()
        {
            var target = new LanguageVersionInput {
                SuppliedInput = null
            };

            var result = target.Validate();

            result.ShouldBe(LanguageVersion.Default);
        }