Esempio n. 1
0
        public async Task TimerTest(string fileName, string type)
        {
            using var stream = File.Open($"TemplateTests/{fileName}", FileMode.Open);
            var file = Substitute.For <IFormFile>();

            file.OpenReadStream().Returns(stream);
            var command = new ProductTemplateCommand(Substitute.For <AppSettings>());
            var timer   = new Stopwatch();

            timer.Start();
            switch (type)
            {
            case "flat":
                await command.ParseProductTemplateFlat(file, new VerifiedUserContext(new ClaimsPrincipal()));

                break;

            case "related":
                await command.ParseProductTemplate(file, new VerifiedUserContext(new ClaimsPrincipal()));

                break;
            }
            timer.Stop();
            Assert.IsTrue(timer.Elapsed.Minutes < 5, $"Elapsed time for {type}: {timer.Elapsed.Minutes}");
        }