using Centron.BusinessLogic; using Centron.BusinessLogic.Sales.Support; using Centron.BusinessLogic.WebServices.Sales.Support; using Centron.Data.WebServices.Sales.Support; using Centron.Interfaces.BL; using Centron.Tests.EndToEnd.Infrastructure; using Xunit; using Xunit.Abstractions; namespace Centron.Tests.EndToEnd.Tests.Helpdesk { public class HelpdeskSolutionTests : EndToEndTest { private readonly int _referenceHelpdeskI3D = 10491; private readonly int _referenceSolutionI3D = 38; public HelpdeskSolutionTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } public override void Execute() { this.GetSolutions(); this.GetSolution(); this.SaveSolution(); this.AddSolutionToHelpdesk(); this.RemoveSolutionFromHelpdesk(); } private void GetSolutions() { using var session = new BLSession(); var filter = new SearchHelpdeskSolution(); var solutions = session.GetBL().GetHelpdeskSolutions(filter); this.Verifier.Verify("Solutions", solutions); } private void GetSolution() { var solution = this.GetSolutionInternal(); this.Verifier.Verify("Solution", solution); } private void SaveSolution() { var solution = this.GetSolutionInternal(); solution.Caption = "Grafikkarte ist nicht defekt"; solution.MainCategoryI3D = 28; solution.SubCategory1I3D = 29; solution.SubCategory2I3D = 39; using var session = new BLSession(); var updatedSolution = session.GetBL().SaveHelpdeskSolution(this.GetLoggedInUser(), solution); this.Verifier.Verify("UpdatedSolution", updatedSolution); } private HelpdeskSolutionDTO GetSolutionInternal() { using var session = new BLSession(); return session.GetBL().GetHelpdeskSolutionByI3D(this._referenceSolutionI3D); } private void AddSolutionToHelpdesk() { // the helpdesk does not have a solution assigned in the beginning using var session = new BLSession(); var result = session.GetBL().AssignSolutionToHelpdesk(this.GetLoggedInUser(), this._referenceHelpdeskI3D, this._referenceSolutionI3D); Assert.Equal(ResultStatus.Success, result.Status); var solution = this.GetSolutionFromHelpdeskInternal(); this.Verifier.Verify("AddedSolution", solution); } private HelpdeskSolutionDTO GetSolutionFromHelpdeskInternal() { using var session = new BLSession(); return session.GetBL().GetHelpdeskSolutionFromHelpdesk(this._referenceHelpdeskI3D); } private void RemoveSolutionFromHelpdesk() { using var session = new BLSession(); var result = session.GetBL().RemoveSolutionFromHelpdesk(this.GetLoggedInUser(), this._referenceHelpdeskI3D); Assert.Equal(result.Status.ToString(), ResultStatus.Success.ToString()); var solution = this.GetSolutionFromHelpdeskInternal(); Assert.Null(solution); } } }