Beispiel #1
0
        public async Task Run(Func <ITweek, IContextDriver, Task> test)
        {
            Exception e = null;

            try
            {
                await _init();

                var parserSettings = new ParserSettings((b) =>
                {
                    using (var sha1 = SHA1.Create())
                    {
                        return(sha1.ComputeHash(b));
                    }
                }, FSharpOption <IDictionary <string, ComparerDelegate> > .Some(new Dictionary <string, ComparerDelegate>())

                                                        );
                var tweek = await Tweek.Create(_rulesDriver, (any) => JPadRulesParserAdapter.Convert(new JPadParser(parserSettings)));
                await test(tweek, _contextDriver);
            }
            catch (Exception ex)
            {
                e = ex;
            }
            await _dispose();

            if (e != null)
            {
                throw e;
            }
        }
Beispiel #2
0
 private static IRuleParser CreateJPadParser() => JPadRulesParserAdapter.Convert(new JPadParser(new ParserSettings(
                                                                                                    Comparers: Microsoft.FSharp.Core.FSharpOption <IDictionary <string, ComparerDelegate> > .Some(new Dictionary <string, ComparerDelegate>()
 {
     ["version"] = Version.Parse
 }), sha1Provider: (s) =>
 {
     using (var sha1 = System.Security.Cryptography.SHA1.Create())
     {
         return(sha1.ComputeHash(s));
     }
 })));