Ejemplo n.º 1
0
        public async Task Return_ListUserSensorsView()
        {
            var sensorsService = new Mock <ISensorsService>();
            var user           = GetUser();
            var testSensor     = TestUserSensor();

            sensorsService.Setup(s => s.ListSensorsAsync(user.Id)).
            ReturnsAsync(new List <UserSensor>()
            {
                testSensor
            });

            var controller = new ManageSensorsController(sensorsService.Object);

            var result = await controller.ListUserSensors(user.Id, user.UserName) as ViewResult;

            Assert.AreEqual("ListUserSensors", result.ViewName);
        }
Ejemplo n.º 2
0
        public async Task ReturnUserSensors_AsListSensorSViewModel()
        {
            var sensorsService = new Mock <ISensorsService>();
            var user           = GetUser();
            var testSensor     = TestUserSensor();

            sensorsService.Setup(s => s.ListSensorsAsync(user.Id)).
            ReturnsAsync(new List <UserSensor>()
            {
                testSensor
            });

            var controller = new ManageSensorsController(sensorsService.Object);

            var result = await controller.ListUserSensors(user.Id, user.UserName) as ViewResult;

            var viewModel = (ListSensorSViewModel)result.ViewData.Model;

            Assert.AreEqual(1, viewModel.UserSensors.Count());
        }