示例#1
0
        public async Task ReadTemplate()
        {
            var modelText = await File.ReadAllTextAsync("Model.xml");

            await using var modelTextStream = new MemoryStream(Encoding.UTF8.GetBytes(modelText));

            var section = new MultipartSection
            {
                Body    = modelTextStream,
                Headers = new Dictionary <string, StringValues>
                {
                    { "Content-Type", new StringValues("text/xml") },
                }
            };

            var template = await ImportController.ReadTemplate(section);

            Assert.IsAssignableFrom <Template>(template);
            Approvals.Verify(JsonConvert.SerializeObject(template, Formatting.Indented));
        }