예제 #1
0
        public void Install(IServiceCollection services, IConfiguration configuration)
        {
            var searchRegex = configuration.GetSection(nameof(PlatformRecognizerOptions)).Get <PlatformRecognizerOptions>();

            RegexManager.AddRegex(nameof(searchRegex.WindowsRegex), searchRegex.WindowsRegex);
            RegexManager.AddRegex(nameof(searchRegex.LinuxRegex), searchRegex.LinuxRegex);
        }
예제 #2
0
        public void Match_True()
        {
            var manager   = new RegexManager <bool>(() => { Assert.True(false); });
            var IsMatched = manager
                            .AddRegex(new RegexExecute <bool>("[0-9]", (m) => { return(m.Success); }))
                            .AddRegex(new RegexExecute <bool>("[a-z]", (m) => { return(m.Success); }))
                            .Run("7");

            Assert.True(IsMatched);
        }
예제 #3
0
        public void Match_True_And_Equals_Value()
        {
            var testValue = "7";

            RegexManager <Match> manager = new RegexManager <Match>(() => { Assert.True(false); });
            var match = manager
                        .AddRegex(new RegexExecute <Match>("[0-9]", (m) => { return(m); }))
                        .AddRegex(new RegexExecute <Match>("[a-z]", (m) => { return(m); }))
                        .Run(testValue);

            Assert.True(match.Success);
            Assert.Equal(testValue, match.Value);
        }