Exemple #1
0
        public async Task AssertThat_CSharpUtilsGlobals_Work()
        {
            var service = new EvalCSharpHandler();

            EvalResponse response = await service.EvalCSharpPrivate(new EvalRequest { Code = "ListOf(1, 2, 3)" });

            Assert.Equal("System.Collections.Generic.List`1[System.Int32]", response.Result);
        }
Exemple #2
0
        public async Task AssertThat_CSharpUtils_Works()
        {
            var service = new EvalCSharpHandler();

            EvalResponse response = await service.EvalCSharpPrivate(new EvalRequest { Code = "Optional.OfNullable(\"text\")" });

            Assert.Equal("Optional(text)", response.Result);
        }
Exemple #3
0
        public async Task AssertThat_CSharpUtilsExtenders_Work()
        {
            var service = new EvalCSharpHandler();

            EvalResponse response = await service.EvalCSharpPrivate(new EvalRequest { Code = "new List<String>().NotContains(\"empty\")" });

            Assert.Equal("True", response.Result);
        }
Exemple #4
0
        public async Task AssertThat_ClassDeclarations_Work()
        {
            var service = new EvalCSharpHandler();

            EvalResponse response = await service.EvalCSharpPrivate(new EvalRequest { Code = "public class Test { public String Foo => \"Hullo!\"; } new Test().Foo" });

            Assert.Equal("Hullo!", response.Result);
        }
Exemple #5
0
        public async Task AssertThat_LinqImportsWork()
        {
            var service = new EvalCSharpHandler();

            EvalResponse response = await service.EvalCSharpPrivate(new EvalRequest { Code = "new [] { 0, 1, 2, 3, 4, }.Where(it => it < 3).Select(it => it.ToString()).ToList().Aggregate((l, r) => l + \", \" + r)" });

            Assert.Equal("0, 1, 2", response.Result);
        }
Exemple #6
0
        public async Task AssertThat_ImportsWork()
        {
            var service = new EvalCSharpHandler();

            EvalResponse response = await service.EvalCSharpPrivate(new EvalRequest { Code = "Int32.MaxValue" });

            Assert.Equal("2147483647", response.Result);
        }
Exemple #7
0
        public async Task AssertThat_ConsoleLogging_IsEvaluated()
        {
            var service = new EvalCSharpHandler();

            EvalResponse response = await service.EvalCSharpPrivate(new EvalRequest { Code = "Console.WriteLine(\"Hello, World!\")" });

            Assert.Equal("Result: null\r\nOutput:\r\nHello, World!\r\n", response.Result);
        }
Exemple #8
0
        public async Task AssertThat_HelloWorld_IsEvaluated()
        {
            var service = new EvalCSharpHandler();

            EvalResponse response = await service.EvalCSharpPrivate(new EvalRequest { Code = "\"Hello, World!\"" });

            Assert.Equal("Hello, World!", response.Result);
        }