Ejemplo n.º 1
0
        public async Task TransformAsync_Custom_Test()
        {
            var t = new TransformerService();
            var s = await t.TransformAsync("Hoang [[A]] Duy", new { A = "Bao" });

            s.Should().Be("Hoang [Bao] Duy");
        }
Ejemplo n.º 2
0
        public async Task TransformAsync_DefaultData_Test()
        {
            var t = new TransformerService(op => op.GlobalParameters = new object[] { new { A = "Bao" } });
            var s = await t.TransformAsync("Hoang [A] Duy");

            s.Should().Be("Hoang Bao Duy");
        }
Ejemplo n.º 3
0
        public async Task Transform_HugeTemplate_Async_Test()
        {
            var d        = Path.GetDirectoryName(typeof(TransformTests).Assembly.Location);
            var template = await File.ReadAllTextAsync(d + "/TestData/Data.txt");

            var t = new TransformerService();
            var s = await t.TransformAsync(template, new { A = "Hoang", B = "Bao", C = "Duy", D = "HBD" });

            s.Should().ContainAll("Hoang", "Bao", "Duy", "HBD")
            .And.Subject.Should().NotContainAny("{", "[", "<");
        }
Ejemplo n.º 4
0
        public async Task Transform_HugeTemplate_Async_DataProvider_Test()
        {
            var d        = Path.GetDirectoryName(typeof(TransformTests).Assembly.Location);
            var template = await File.ReadAllTextAsync(d + "/TestData/Data.txt");

            var t = new TransformerService();
            var s = await t.TransformAsync(template, token => Task.FromResult("Duy" as object));

            s.Should().Contain("Duy")
            .And.Subject.Should().NotContainAny("{", "[", "<");
        }