예제 #1
0
        public async Task Return_AllUserSensorsView()
        {
            var sensorsService = new Mock <ISensorsService>();
            var user           = GetUser();
            var testSensor     = TestUserSensor();

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

            var controller = new ManageSensorsController(sensorsService.Object);

            var result = await controller.AllUserSensors() as ViewResult;

            Assert.AreEqual("AllUserSensors", result.ViewName);
        }
예제 #2
0
        public async Task ReturnAllUserSensors_AsAllSensorSViewModel()
        {
            var sensorsService = new Mock <ISensorsService>();
            var user           = GetUser();
            var testSensor     = TestUserSensor();

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

            var controller = new ManageSensorsController(sensorsService.Object);

            var result = await controller.AllUserSensors() as ViewResult;

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

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