public void TestSceneCreator() { SensorCreatorView scv = new SensorCreatorView(); Assert.AreEqual(string.Empty, scv.ModelID, "Test ipsensor creation get default"); Assert.AreEqual(string.Empty, scv.SwVersion, "Test swversion creation get default"); Assert.AreEqual(0, scv.Type, "Test type creation get default"); Assert.AreEqual(string.Empty, scv.Name, "Test type creation get default"); scv.Url = "http://www.google.ca"; Assert.AreEqual("http://www.google.ca", scv.Url, "Test set/get Url"); scv.Url = string.Empty; Assert.AreNotEqual(string.Empty, scv.Url, "Test get/set invalid url"); Assert.IsTrue(scv.HasErrors); scv.Url = "http://www.google.ca"; // remove the errors. scv.Type = 3; Assert.AreEqual(3, scv.Type, "Test set/get Type"); scv.Type = 9; Assert.AreNotEqual(9, scv.Type, "Test invalid value Type"); Assert.AreEqual(0, scv.Type, "Test invalid value type to default"); scv.Name = "Test"; Assert.AreEqual("Test", scv.Name, "Test set/get Name"); scv.Name = string.Empty; //Assert.AreNotEqual(string.Empty, scv.Name, "Test set/get name invalid value"); Assert.IsTrue(scv.HasErrors, "Test if errors has been triggered"); scv.Name = "Test"; scv.ModelID = "PATATE"; Assert.AreEqual("PATATE", scv.ModelID, "Test set/get ModelID"); scv.ModelID = string.Empty; //Assert.AreNotEqual(string.Empty, scv.ModelID, "Test set/get invalid ModelID"); Assert.IsTrue(scv.HasErrors, "Test if errors has been triggered"); scv.ModelID = "PATATE"; scv.On = true; Assert.AreEqual(true, scv.On, "Test set/get On"); scv.ManufacturerName = "TestMFGName"; Assert.AreEqual("TestMFGName", scv.ManufacturerName, "Test get/set mfg name"); scv.Url = "http://google.ca"; scv.Type = 2; Assert.AreEqual("http://google.ca", scv.Url, "Test change type that keeps url"); Assert.IsTrue(scv.HasUrl, "Test has url true"); }
public void TestSceneCreatorWithInit() { SensorCreatorView scv = new SensorCreatorView(new Sensor() { name = "NewSensor", modelid = "sensormodel", manufacturername = "mymanufacturer", swversion = "1.0", type = "IPSENSOR", config = new SensorConfig() { on = true, url = "http://google.ca" }, }); Assert.AreEqual("NewSensor", scv.Name, "Test Name init"); Assert.AreEqual("sensormodel", scv.ModelID, "Test Modelid init"); Assert.AreEqual("mymanufacturer", scv.ManufacturerName, "test Manufacturer Name init"); Assert.AreEqual("1.0", scv.SwVersion, "Test SwVersion init"); Assert.AreEqual(0, scv.Type, "Test Type init"); Assert.IsTrue(scv.HasUrl, "Test HasUrl init"); Assert.IsTrue(scv.On, "test On init"); }