Exemple #1
0
        public void ReturnRegisterBoolensorView_WithViewModel_WhenParameterIBoolType()
        {
            // Arrange
            var sensorServiceMock = new Mock <ISensorService>();
            var httpClientMock    = new Mock <IHttpClientProvider>();

            var controller = new RegistrationController(sensorServiceMock.Object,
                                                        httpClientMock.Object);

            controller.UserMocking("test");

            var apiParameter = new SensorApiData
            {
                IsValueType = false,
                Id          = "21312312",
                MeasureType = "true/false",
                MinPollingIntervalInSeconds = 1
            };

            // Act
            controller.GetProperRegView(apiParameter);

            // Assert
            controller
            .WithCallTo(r => r.GetProperRegView(apiParameter))
            .ShouldRenderView("RegisterBoolSensor")
            .WithModel <SensorViewModel>(s =>
            {
                Assert.IsFalse(apiParameter.IsValueType);
            });
        }
Exemple #2
0
        public void ReturnRegisterValueSensorView_WithViewModel_WhenParameterIsValueType()
        {
            // Arrange
            var sensorServiceMock = new Mock <ISensorService>();
            var httpClientMock    = new Mock <IHttpClientProvider>();

            var controller = new RegistrationController(sensorServiceMock.Object,
                                                        httpClientMock.Object);

            controller.UserMocking("test");

            var apiParameter = new SensorApiData
            {
                IsValueType  = true,
                Highestvalue = 10,
                LowestValue  = 5,
                Id           = "21312312",
                MeasureType  = "W",
                MinPollingIntervalInSeconds = 1
            };

            // Act
            controller.GetProperRegView(apiParameter);

            // Assert
            controller
            .WithCallTo(r => r.GetProperRegView(apiParameter))
            .ShouldRenderView("RegisterValueSensor")
            .WithModel <SensorViewModel>(s =>
            {
                Assert.IsTrue(apiParameter.IsValueType);
                Assert.AreEqual(s.HighestValue, apiParameter.Highestvalue);
                Assert.AreEqual(s.LowestValue, apiParameter.LowestValue);
            });
        }