public static void SaveFan(int id, string name, int temp, int humid) { FanOutput savedFan = new FanOutput(id, name, temp, humid); FanOutPutController con = new FanOutPutController(); con.Post(savedFan); //FanServerList.Add(savedFan); }
public void NameNull() { //arrange FanOutput fo = new FanOutput(); //act fo.Name = null; //assert //asserting in tag }
public void Put(int id, [FromBody] FanOutput value) { FanOutput FanOutputs = Get(id); if (FanOutputs != null) { FanOutputs.Name = value.Name; FanOutputs.Humidity = value.Humidity; FanOutputs.Temp = value.Temp; } }
public void Put(int id, [FromBody] FanOutput value) { FanOutput fanOutput = Get(id); if (fanOutput != null) { fanOutput.Name = value.Name; fanOutput.Temperature = value.Temperature; fanOutput.Humidity = value.Humidity; } }
public void Put(int id, [FromBody] FanOutput value) { FanOutput fan = Get(id); if (fan != null) { fan.Fugt = value.Fugt; fan.Name = value.Name; fan.Temp = value.Temp; } }
public void TempTooLow() { //arrange FanOutput fo = new FanOutput(); double newTemp = 14.9; //act fo.Temp = newTemp; //assert //asserting in tag }
public void TempCorrectFormat() { //arrange FanOutput fo = new FanOutput(); double newTemp = 15; //act fo.Temp = newTemp; //assert Assert.AreEqual(fo.Temp, newTemp); }
public void NameTooShort() { //arrange FanOutput fo = new FanOutput(); string newName = "T"; //act fo.Name = newName; //assert //asserting in tag }
public void TestToString() { //arrange FanOutput fo = new FanOutput(1, "Test", 20, 55); //act string foToString = fo.ToString(); string expectedResult = "ID: 1, Name: Test, Temp: 20, Humidity: 55"; //assert Assert.AreEqual(foToString, expectedResult); }
public void HumidTooHigh() { //arrange FanOutput fo = new FanOutput(); double newHumid = 80.1; //act fo.Humidity = newHumid; //assert //asserting in tag }
public void HumidTooLow() { //arrange FanOutput fo = new FanOutput(); double newHumid = 29.9; //act fo.Humidity = newHumid; //assert //asserting in tag }
public void HumidCorrectFormat() { //arrange FanOutput fo = new FanOutput(); double newHumid = 30; //act fo.Humidity = newHumid; //assert Assert.AreEqual(fo.Humidity, newHumid); }
public void NameCorrectFormat() { //arrange FanOutput fo = new FanOutput(); string newName = "Test"; //act fo.Name = newName; //assert Assert.AreEqual(fo.Name, newName); }
public void TempTooHigh() { //arrange FanOutput fo = new FanOutput(); double newTemp = 25.1; //act fo.Temp = newTemp; //assert //asserting in tag }
public void SetID() { //arrange FanOutput fo = new FanOutput(); int newID = 1; //act fo.ID = newID; //assert Assert.AreEqual(fo.ID, newID); }
public void FanOutputWithInvalidHighTemp() { try { FanOutput testOutput = new FanOutput("Et", 26, 50); Assert.Fail("An exception should be thrown here"); } catch (ArgumentException e) { Assert.AreEqual("Temperaturen er for høj", e.Message); } }
public void Put(int id, [FromBody] FanOutput value) { FanOutput fanOutput = Get(id); if (fanOutput != null) { fanOutput.Id = value.Id; fanOutput.Navn = value.Navn; fanOutput.Temp = value.Temp; fanOutput.Fugt = value.Fugt; } }
public void FanOutputWithValidHighTemp() { try { FanOutput testOutput = new FanOutput("Et", 25, 50); Assert.AreEqual(25, testOutput.Temp); } catch (ArgumentException) { Assert.Fail("No exception should be thrown here"); } }
public void CreateEmptyFanOutput() { try { FanOutput testOutput = new FanOutput(); Assert.AreEqual(null, testOutput.Navn); } catch (Exception) { Assert.Fail("No exception should be thrown here"); } }
public void FanOutputWithValidNavn() { try { FanOutput testOutput = new FanOutput("Et", 20, 50); Assert.AreEqual("Et", testOutput.Navn); } catch (ArgumentException) { Assert.Fail("No exception should be thrown here"); } }
public void FanOutputWithValidHighFugt() { try { FanOutput testOutput = new FanOutput("Et", 20, 80); Assert.AreEqual(80, testOutput.Fugt); } catch (ArgumentException) { Assert.Fail("No exception should be thrown here"); } }
public void FanOutputWithInvalidNavn() { try { FanOutput testOutput = new FanOutput("E", 20, 50); Assert.Fail("An exception should be thrown here"); } catch (ArgumentException e) { Assert.AreEqual("Navn skal minimum være på 2 karakterer", e.Message); } }
public void FanOutputWithInvalidHighFugt() { try { FanOutput testOutput = new FanOutput("Et", 20, 81); Assert.Fail("An exception should be thrown here"); } catch (ArgumentException e) { Assert.AreEqual("Fugtigheden er for høj", e.Message); } }
public void Put(int id, [FromBody] FanOutput value) { FanOutput output = Get(id); if (output != null) { output.Id = value.Id; output.Name = value.Name; output.Temp = value.Temp; output.Humidity = value.Humidity; } }
public void FanOutputSetAndGetId() { try { FanOutput testOutput = new FanOutput("Et", 20, 80); testOutput.Id = 1; Assert.AreEqual(1, testOutput.Id); } catch (Exception) { Assert.Fail("No exception should be thrown here"); } }
public void Post([FromBody] FanOutput value) { try { value.Id = nextId; ListOfFanOutputs.Add(value); nextId++; } catch (Exception e) { Console.WriteLine(e); } }
public void TestContructor() { //arrange int ID = 1; string Name = "Test"; double Temp = 18; double Humid = 35; //act FanOutput fo = new FanOutput(ID, Name, Temp, Humid); //assert Assert.IsNotNull(fo); }
public static FanOutput GetFanFromID(int id) { FanOutput FanFromInput = null; foreach (var fan in FanServerList) { if (fan.Id == id) { FanFromInput = fan; } } return(FanFromInput); }
public void TestFugtLav() { try { FanOutput output = new FanOutput() { Fugt = 22 }; Assert.Fail(); } catch (Exception e) { Assert.AreEqual("fugten er for lav", e.Message); } }
public void TestFugtHigh() { try { FanOutput output = new FanOutput() { Fugt = 85 }; Assert.Fail(); } catch (Exception e) { Assert.AreEqual("fugten er for høj", e.Message); } }