Ejemplo n.º 1
0
        public async Task Add_Category_NOK()
        {
            DbHandler ticket   = new DbHandler(connString);
            Message   response = await ticket.AddCategoryAsync("UnitTest2", await ticket.GetSystemAsync("atihome"));

            response = await ticket.AddCategoryAsync("UnitTest2", await ticket.GetSystemAsync("atihome"));

            await ticket.DeleteCategoryAsync("UnitTest2", await ticket.GetSystemAsync("atihome"));

            Assert.AreEqual(MessageType.NOK, response.MessageType, "Final: Category duplication check failed");
        }
Ejemplo n.º 2
0
        public async Task Add_Category_OK()
        {
            DbHandler ticket   = new DbHandler(connString);
            Message   response = await ticket.AddCategoryAsync("UnitTest1", await ticket.GetSystemAsync("atihome"));

            await ticket.DeleteCategoryAsync("UnitTest1", await ticket.GetSystemAsync("atihome"));

            Assert.AreEqual(MessageType.OK, response.MessageType, "Final: UnitTest1 could not be added");
        }
Ejemplo n.º 3
0
        public async Task Delete_Category1_OK()
        {
            DbHandler ticket    = new DbHandler(connString);
            var       response1 = await ticket.AddCategoryAsync("UnitTest6", await ticket.GetSystemAsync("atihome"));

            Assert.AreEqual(MessageType.OK, response1.MessageType, "Preparation failed: UnitTest 6 could not be added");

            var response2 = await ticket.DeleteCategoryAsync("UnitTest6", await ticket.GetSystemAsync("atihome"));

            Assert.AreEqual(MessageType.OK, response2.MessageType, "Final: Category deletion is OK");
        }
Ejemplo n.º 4
0
        public async Task Change_Category_OK()
        {
            DbHandler ticket    = new DbHandler(connString);
            Message   response1 = await ticket.AddCategoryAsync("UnitTest3", await ticket.GetSystemAsync("atihome"));

            Assert.AreEqual(MessageType.OK, response1.MessageType, "Preparation: UnitTest3 could not be added");

            Message response2 = await ticket.RenameCategoryAsync("UnitTest3", "UnitTest3_Changed", await ticket.GetSystemAsync("atihome"));

            await ticket.DeleteCategoryAsync("UnitTest3_Changed", await ticket.GetSystemAsync("atihome"));

            Assert.AreEqual(MessageType.OK, response2.MessageType, "Final: Category change is done");
        }
Ejemplo n.º 5
0
        public async Task Change_Category_NOK_1()
        {
            DbHandler ticket    = new DbHandler(connString);
            Message   response1 = await ticket.AddCategoryAsync("UnitTest4", await ticket.GetSystemAsync("atihome"));

            Assert.AreEqual(MessageType.OK, response1.MessageType, "Preparation: UnitTest4 could not be added");

            Message response2 = await ticket.RenameCategoryAsync("UnitTest4", "System", await ticket.GetSystemAsync("atihome"));

            await ticket.DeleteCategoryAsync("UnitTest4", await ticket.GetSystemAsync("atihome"));

            Assert.AreEqual(MessageType.NOK, response2.MessageType, "Final: Category was renamed to an already exist category");
        }
Ejemplo n.º 6
0
        public async Task Delete_Category2_OK()
        {
            DbHandler ticket    = new DbHandler(connString);
            var       response1 = await ticket.AddCategoryAsync("UnitTest8", await ticket.GetSystemAsync("atihome"));

            Assert.AreEqual(MessageType.OK, response1.MessageType, "Preparation: UnitTest8 could not be added");

            var response2 = await ticket.ListCategoriesAsync();

            int id = 0;

            foreach (var item in response2)
            {
                if (item.Name == "UnitTest8")
                {
                    id = item.Id;
                }
            }
            Assert.AreNotEqual(0, id, "Preparation: Earlier added category could not find");

            var response3 = await ticket.DeleteCategoryAsync(id);

            Assert.AreEqual(MessageType.OK, response3.MessageType, "Final: Category deletion by ID was unsuccessful");
        }