using System; using System.Linq; using Centron.BusinessLogic.WebServices.ItPlanner; using Centron.BusinessLogic.WebServices.Sales.Support; using Centron.Interfaces.BL; using Centron.Interfaces.ItPlaner; using Centron.Interfaces.Sales.Helpdesks; using Centron.Tests.EndToEnd.Infrastructure; using Xunit; using Xunit.Abstractions; namespace Centron.Tests.EndToEnd.Tests.ServiceBoardWeb; public class ServiceBoardWebTests(ITestOutputHelper testOutputHelper) : EndToEndTest(testOutputHelper) { [SkipOnLinuxFact] public override void Execute() { this.PrepareDatabase(); this.TestHelpdeskType(); this.TestHelpdeskStatus(); this.TestHelpdeskPriority(); this.TestHelpdeskCategory(); this.TestHelpdeskTimerType(); this.TestVirtualObjectCategory(); } private void PrepareDatabase() { } private void TestHelpdeskType() { const int TypeI3D = 1; var types = this.WithSession(s => s.GetBL().GetHelpdeskTypes(new HelpdeskTypeFilter())); var type = types.First(f => f.I3D == TypeI3D); type.ServiceBoardWebColor = "#FF0000"; type.ServiceBoardWebIcon = "thumbs-up"; this.WithSession(s => s.GetBL().SaveHelpdeskType(type)); var typesAfterSave = this.WithSession(s => s.GetBL().GetHelpdeskTypes(new HelpdeskTypeFilter())); this.Verifier.Verify("HelpdeskType", typesAfterSave.First(f => f.I3D == TypeI3D)); } private void TestHelpdeskStatus() { const int StatusI3D = 2; var allStatus = this.WithSession(s => s.GetBL().GetHelpdesksStates()); var status = allStatus.First(f => f.I3D == StatusI3D); status.ServiceBoardWebColor = "#FF0000"; status.ServiceBoardWebIcon = "thumbs-up"; this.WithSession(s => s.GetBL().SaveHelpdeskStatus(status)); var allStatusAfterSave = this.WithSession(s => s.GetBL().GetHelpdesksStates()); this.Verifier.Verify("HelpdeskStatus", allStatusAfterSave.First(f => f.I3D == StatusI3D)); } private void TestHelpdeskPriority() { const int PriorityI3D = 2; var allPriorities = this.WithSession(s => s.GetBL().GetActiveHelpdeskPriorities()); var priority = allPriorities.First(f => f.I3D == PriorityI3D); priority.ServiceBoardWebColor = "#FF0000"; priority.ServiceBoardWebIcon = "thumbs-up"; this.WithSession(s => s.GetBL().UpdateActiveHelpdeskPriorities(allPriorities)); var allPrioritiesAfterSave = this.WithSession(s => s.GetBL().GetActiveHelpdeskPriorities()); this.Verifier.Verify("HelpdeskPriority", allPrioritiesAfterSave.First(f => f.I3D == PriorityI3D)); } private void TestHelpdeskCategory() { const int CategoryI3D = 10; var allCategories = this.WithSession(s => s.GetBL().GetHelpdeskCategories(new HelpdeskCategoryFilter())); var category = allCategories.First(f => f.I3D == CategoryI3D); category.ServiceBoardWebColor = "#FF0000"; category.ServiceBoardWebIcon = "thumbs-up"; this.WithSession(s => s.GetBL().SaveHelpdeskCategoryV2(category)); var allCategoriesAfterSave = this.WithSession(s => s.GetBL().GetHelpdeskCategories(new HelpdeskCategoryFilter())); this.Verifier.Verify("HelpdeskCategory", allCategoriesAfterSave.First(f => f.I3D == CategoryI3D)); } private void TestHelpdeskTimerType() { const int TimerTypeI3D = 3; var allTimerTypes = this.WithSession(s => s.GetBL().GetHelpdeskTimerTypes()); var timerType = allTimerTypes.First(f => f.I3D == TimerTypeI3D); timerType.ServiceBoardWebColor = "#FF0000"; timerType.ServiceBoardWebIcon = "thumbs-up"; this.WithSession(s => s.GetBL().SaveHelpdeskTimerType(timerType)); var allTimerTypesAfterSave = this.WithSession(s => s.GetBL().GetHelpdeskTimerTypes()); this.Verifier.Verify("HelpdeskTimerType", allTimerTypesAfterSave.First(f => f.I3D == TimerTypeI3D)); } private void TestVirtualObjectCategory() { const int CategoryI3D = 1; var allCategories = this.WithSession(s => s.GetBL().GetChecklistVirtualObjectCategoriesByFilter(new RBChecklistVirtualObjectCategoryFilter())).ThrowIfError(); var category = allCategories.First(f => f.I3D == CategoryI3D); category.ServiceBoardWebIcon = "thumbs-up"; this.WithSession(s => s.GetBL().SaveOrUpdateChecklistVirtualObjectCategory(category)); var allCategoriesAfterSave = this.WithSession(s => s.GetBL().GetChecklistVirtualObjectCategoriesByFilter(new RBChecklistVirtualObjectCategoryFilter())).ThrowIfError(); this.Verifier.Verify("VirtualObjectCategory", allCategoriesAfterSave.First(f => f.I3D == CategoryI3D)); } }