public async Task Change_Ticket_Test_1() { DbHandler ticket = new DbHandler(connString); // Open ticket and send 2 further update TicketCreationTemplate crt = new TicketCreationTemplate(); crt.Category = await ticket.GetCategoryAsync("Teszt", await ticket.GetSystemAsync("atihome")); crt.Details = "Here is the details"; crt.Reference = "unit-test-change-1"; crt.Summary = "Test of ticket"; crt.Title = "Test ticket"; var respond1 = await ticket.CreateTicketAsync(crt); Assert.AreEqual(MessageType.OK, respond1.MessageType, "Preparation: Ticket could not be created"); // Query for the opened change TicketFilterTemplate filter1 = new TicketFilterTemplate(); filter1.System = "atihome"; filter1.Status = "Open"; filter1.Reference = crt.Reference; var respond12 = await ticket.ListTicketsAsync(filter1); Assert.AreEqual(1, respond12.Count, "Preparation: opened ticket was not found"); // Change the category to Tesztike TicketChangeTemplate chg = new TicketChangeTemplate(); chg.Id = respond12[0].Id; chg.Category = await ticket.GetCategoryAsync("Hardware", await ticket.GetSystemAsync("atihome")); var respond2 = await ticket.ChangeTicketAsync(chg); Assert.AreEqual(MessageType.OK, respond2.MessageType, "Final: Ticket change was failed"); // Query the latest changed ticket TicketFilterTemplate filter2 = new TicketFilterTemplate(); filter2.System = "atihome"; filter2.Status = "Open"; filter2.Reference = crt.Reference; filter2.Category = "Hardware"; var respond3 = await ticket.ListTicketsAsync(filter2); Assert.AreEqual(1, respond3.Count, "Final: No ticket was found with the changed category name"); // Close ticket var respond4 = await ticket.CloseTicketAsync(crt.Reference, "atihome", null); Assert.AreEqual(MessageType.OK, respond4.MessageType, "Post: Close was failed"); }
public async Task Change_Ticket_Test_2() { DbHandler ticket = new DbHandler(connString); // Open ticket and send 2 further update TicketCreationTemplate crt = new TicketCreationTemplate(); crt.Category = await ticket.GetCategoryAsync("Teszt", await ticket.GetSystemAsync("atihome")); crt.Details = "Here is the details"; crt.Reference = "unit-test-change-2"; crt.Summary = "Test of ticket"; crt.Title = "Test ticket"; var respond1 = await ticket.CreateTicketAsync(crt); Assert.AreEqual(MessageType.OK, respond1.MessageType, "Preparation: Ticket could not be created"); var ticketHead1 = await ticket.ListTicketsAsync(new TicketFilterTemplate() { Reference = crt.Reference, Status = "Open", System = "atihome" }); string old_cat = ticketHead1[0].Category.Name; // Query for the opened change TicketFilterTemplate filter1 = new TicketFilterTemplate(); filter1.System = "atihome"; filter1.Status = "Open"; filter1.Reference = crt.Reference; var respond12 = await ticket.ListTicketsAsync(filter1); Assert.AreEqual(1, respond12.Count, "Preparation: opened ticket was not found"); // Try to change for a non-existing category TicketChangeTemplate chg = new TicketChangeTemplate(); chg.Id = respond12[0].Id; chg.Category = await ticket.GetCategoryAsync("non-exist", await ticket.GetSystemAsync("atihome")); var respond2 = await ticket.ChangeTicketAsync(chg); var ticketHead2 = await ticket.ListTicketsAsync(new TicketFilterTemplate() { Reference = crt.Reference, Status = "Open", System = "atihome" }); Assert.AreEqual(old_cat, ticketHead2[0].Category.Name, "Final: Ticket was changed to the a non-exist category"); // Close the ticket await ticket.CloseTicketAsync(crt.Reference, "atihome", null); }