/// <summary>
        /// the supporting function that setup the requirements for UPdateIntervention related tests
        /// </summary>
        /// <param name="clientDistrictId">the guid of the client's district</param>
        /// <param name="userDistrictId">the guid of the manager's district</param>
        /// <returns>the guid of the generated intervention</returns>
        private Guid IMSLogicManager_UpdateInterventionTests_Setup(Guid clientDistrictId, Guid userDistrictId)
        {
            Guid clientId = new Guid();

            Mock <IInterventionDataAccess> interventions = new Mock <IInterventionDataAccess>();

            IMSDBLayer.DataModels.Intervention intervention = new IMSDBLayer.DataModels.Intervention()
            {
                ClientId = clientId
            };
            interventions.Setup(i => i.fetchInterventionsById(It.IsAny <Guid>())).Returns(intervention);

            Mock <IDistrictDataAccess> districts = new Mock <IDistrictDataAccess>();
            District District_Syd = new District("Sydney")
            {
                Id = District_SydId,
            };
            District District_Nsw = new District("NSW")
            {
                Id = District_NswId,
            };

            districts.Setup(d => d.fetchDistrictById(It.Is <Guid>(id => id == District_SydId))).Returns(District_Syd);
            districts.Setup(d => d.fetchDistrictById(It.Is <Guid>(id => id == District_NswId))).Returns(District_Nsw);
            Mock <IClientDataAccess> clients = new Mock <IClientDataAccess>();
            Client client = new Client("", "", clientDistrictId)
            {
                Id = clientId
            };

            clients.Setup(c => c.fetchClientById(It.IsAny <Guid>())).Returns(client);

            Mock <IUserDataAccess> users = new Mock <IUserDataAccess>();
            User user = new User("AccountantX", 1, 0, 200, "", userDistrictId);

            users.Setup(u => u.fetchUserByIdentityId(It.IsAny <Guid>())).Returns(user);
            users.Setup(u => u.fetchUserById(It.IsAny <Guid>())).Returns(user);

            managerService.Interventions = interventions.Object;
            managerService.Clients       = clients.Object;
            managerService.Users         = users.Object;
            managerService.Districts     = districts.Object;

            return(intervention.Id);
        }
Beispiel #2
0
        public Intervention(IMSDBLayer.DataModels.Intervention intervention)
        {
            base.Id            = intervention.Id;
            base.Hours         = intervention.Hours;
            base.Costs         = intervention.Costs;
            base.LifeRemaining = intervention.LifeRemaining;
            base.Comments      = intervention.Comments;
            base.State         = intervention.State;

            base.DateCreate = intervention.DateCreate;
            base.DateFinish = intervention.DateFinish;

            base.DateRecentVisit    = intervention.DateRecentVisit;
            base.InterventionTypeId = intervention.InterventionTypeId;
            base.ClientId           = intervention.ClientId;
            base.CreatedBy          = intervention.CreatedBy;
            base.ApprovedBy         = intervention.ApprovedBy;
        }