/// <inheritdoc/>
        public ITechnician FindTechnicianByReference(string reference)
        {
            string      requestPath = string.Format("{0}/technicians?reference={1}", Path, System.Uri.EscapeUriString(reference));
            ArrayList   matches     = (ArrayList)(ModelBase.Deserialize(Listen360, Listen360.GetRequestResponseElement(requestPath)));
            ITechnician match       = (matches.Count == 0) ? null : (ITechnician)matches[0];

            return(match);
        }
Example #2
0
        public void FindTechnicianByReferenceNotFound()
        {
            Franchise franchise = new Franchise(_ctx.Listen360, TestUtil.GetElementForXml(Properties.Resources.FakeTechnician1));

            TestUtil.SetupResponseXml(_ctx.WebRequest, "<technicians type=\"array\"></technicians>");
            ITechnician tech = franchise.FindTechnicianByReference("ABC123");

            Assert.Null(tech);
        }
Example #3
0
        public void FindTechnicianByReference()
        {
            Franchise franchise = new Franchise(_ctx.Listen360, TestUtil.GetElementForXml(Properties.Resources.FakeFranchise1));

            TestUtil.SetupResponseXml(_ctx.WebRequest, string.Format("<technicians type=\"array\">{0}</technicians>", Properties.Resources.FakeTechnician1));
            ITechnician tech = franchise.FindTechnicianByReference("ABC123");

            Assert.IsTrue(_ctx.WebRequestFactory.CreateWebRequestCalled);
            Assert.AreEqual(string.Format("{0}/{1}/technicians?reference=ABC123", _ctx.Url, franchise.Path), _ctx.WebRequestFactory.CreateWebRequestLastUrl);
            Assert.NotNull(tech);
        }
Example #4
0
        public void GetTechnicianById()
        {
            Franchise franchise = new Franchise(_ctx.Listen360, TestUtil.GetElementForXml(Properties.Resources.FakeFranchise1));

            TestUtil.SetupResponseXml(_ctx.WebRequest, Properties.Resources.FakeTechnician1);
            ITechnician tech = franchise.GetTechnicianById(3);

            Assert.IsTrue(_ctx.WebRequestFactory.CreateWebRequestCalled);
            Assert.AreEqual(string.Format("{0}/{1}/technicians/3", _ctx.Url, franchise.Path), _ctx.WebRequestFactory.CreateWebRequestLastUrl);
            Assert.NotNull(tech);
        }
Example #5
0
        public bool CheckTechnicianIdExistance(ITechnician technician, int idTechnician)
        {
            List <Technician> allTechnicians = technician.GetAllTechnicians();

            return(allTechnicians.Any(t => t.IdTechnician == idTechnician));
        }
        public void SetTechnicianToDevice(ITechnician technician, Device device, int techniciansId)
        {
            Technician matchedTechnician = technician.GetTechnicianById(techniciansId);

            device.Technician = matchedTechnician;
        }