예제 #1
0
        public void GetCarer_ShouldReturnPatienttWithSameID()
        {
            var context = new TestPacmanRESTContext();

            context.Pacman_carer_db.Add(GetDemoCarer());

            var controller = new CarerController(context);
            var result     = controller.GetPacman_carer_db(1) as OkNegotiatedContentResult <Pacman_carer_db>;

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Content.ID);
        }
예제 #2
0
        public void GetCarer_ShouldReturnAllPatients()
        {
            var context = new TestPacmanRESTContext();

            context.Pacman_carer_db.Add(new Pacman_carer_db {
                ID = 1, device_id = "lotsofstringhere", name = "demoPatient", phone = 4321, address = "address", email = "*****@*****.**"
            });
            context.Pacman_carer_db.Add(new Pacman_carer_db {
                ID = 2, device_id = "lotsofstringhere", name = "demoPatient", phone = 4321, address = "address", email = "*****@*****.**"
            });
            context.Pacman_carer_db.Add(new Pacman_carer_db {
                ID = 3, device_id = "lotsofstringhere", name = "demoPatient", phone = 4321, address = "address", email = "*****@*****.**"
            });

            var controller = new CarerController(context);
            var result     = controller.GetPacman_carer_db() as TestPatientDbSet;

            Assert.IsNotNull(result);
            Assert.AreEqual(3, result.Local.Count);
        }