Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
970 B
3
Indexable
Never
[Test]
        [TestCase("electronics")]
        [TestCase("pavan")]
        public async Task GetProductsInCategory(string name)
        {
            var options = new DbContextOptionsBuilder<TemplateContext>()
                 .UseMySql(ConnectionStrings, new MySqlServerVersion(new Version(8, 0, 23)))
                 .Options;
            using (var dbContext = new TemplateContext(options))
            {
                var repo = new Repo(dbContext);

                var result = await repo.GetProductsInCategory(name);
                Console.WriteLine(result);
                switch (result)
                {
                    case "enter a valid product in the inventory":
                    case (result != null):
                        Assert.Pass();
                        break;
                    default:
                        Assert.Fail();
                        break;
                }
            }
        }
Leave a Comment