Exemplo n.º 1
0
        public PartialViewResult _18([FromBody] Ex18ViewModel vm)
        {
            if (!ModelState.IsValid)
            {
                RedirectToAction(nameof(_18));
            }

            Ex18 ex = new Ex18(vm.Temperature, (TemeratureScale)Enum.Parse(typeof(TemeratureScale), vm.TempScale));

            vm.TempInFarenheight = ex.GetTempInFarenheight().ToString(CultureInfo.InvariantCulture);
            vm.TempInCelsius     = ex.GetTempInCelcius().ToString(CultureInfo.InvariantCulture);

            return(PartialView("_18_partial", vm));
        }
Exemplo n.º 2
0
        public void _18_WhenEntering0Celcius_SholudReturn32Farenheight()
        {
            // Arrange
            int             temp      = 0;
            TemeratureScale tempScale = TemeratureScale.Celsius;
            float           expected  = 32;
            Ex18            ex        = new Ex18(temp, tempScale);

            // Act
            float actual = ex.GetTempInFarenheight();

            // Assert
            Assert.AreEqual(expected, actual);
        }