/// <summary>Processes a client request.</summary> /// <param name="clientRequest">The client request to process.</param> protected virtual void Process(ClientRequest clientRequest) { if (clientRequest is null) { throw new ArgumentNullException(nameof(clientRequest)); } try { switch (clientRequest.RequestedAction) { case RequestedAction.GetAllCases: CasesDataAccess caseDataAccess = new CasesDataAccess(); List <Case> cases = new List <Case>(); Case[] caseArray = cases.ToArray(); TransmissionData transmission = new TransmissionData(caseArray); RespondToClient(transmission); break; case RequestedAction.GetAllSummerysById: SummeryDataAccess summeryDataAccess = new SummeryDataAccess(); List <MettingSummery> summery = summeryDataAccess.GetAllSummerysById(); TransmissionData transmissionSum = new TransmissionData(summery); RespondToClient(transmissionSum); break; case RequestedAction.GetAllCaseKinds: break; case RequestedAction.SaveNewSummery: SummeryDataAccess summeryData = new SummeryDataAccess(); foreach (MettingSummery item in clientRequest.Data.Entities) { summeryData.SafeSummery(item); } break; case RequestedAction.SaveNewCase: CasesDataAccess caseData = new CasesDataAccess(); foreach (Case item in clientRequest.Data.Entities) { caseData.AddCase(item); } break; case RequestedAction.GetAllSecretaries: break; case RequestedAction.GetAllCommands: break; default: break; } } catch (Exception) { throw; } }
public void SecretaryAddAResumé() { MettingSummery mettingSummery = new MettingSummery("Test", new Secretary("something", 1)); SummeryDataAccess summeryDataAccess = new SummeryDataAccess(); List <MettingSummery> resumés = summeryDataAccess.GetAllSummerysById(); summeryDataAccess.SafeSummery(mettingSummery); List <MettingSummery> result = summeryDataAccess.GetAllSummerysById(); Assert.AreNotEqual(result.Count, resumés.Count); }