public void MyTV() { var d = new DeviceItem(); d.Name = "TV"; d.Watts = 1000; d.HoursPerDay = 2; d.DaysPerMonth = 30; var units = d.UnitsPerMonth; Assert.Equal(60.0, units); }
public void MyNoteBook() { var d = new DeviceItem(); d.Name = "Notebook"; d.Watts = 65; d.HoursPerDay = 10; d.DaysPerMonth = 20; var units = d.UnitsPerMonth; Assert.Equal(13.0, units); }
public void AllSupportiveDataShouldNotBeNegative() { var d = new DeviceItem(); d.Name = "TV"; d.Watts = -1000; d.HoursPerDay = -2; d.DaysPerMonth = 30; var ex = Assert.ThrowsAny<Exception>(() => { var units = d.UnitsPerMonth; }); Assert.Equal("Invalid data",ex.Message); }
public void AllowToAddSameObjectMultipleTimesInTheGroup() { var g = new DeviceGroup(); var d = new DeviceItem(); d.Watts = 65; d.HoursPerDay = 10; d.DaysPerMonth = 20; g.Children.Add(d); g.Children.Add(d); // second notebook Assert.Equal(2,g.Children.Count); Assert.Equal(26.0,g.UnitsPerMonth); }
public void OneDeviceInTheGroup() { var g = new DeviceGroup(); var d = new DeviceItem(); d.Watts = 65; d.HoursPerDay = 10; d.DaysPerMonth = 20; g.Children.Add(d); listItems(g); Assert.Equal(13.0, g.UnitsPerMonth); }
public void AllowToAddSameObjectMutipleTimesInTherGroup() { var g = new DeviceGroup(); var d = new DeviceItem(); d.Name = "Notebook"; d.Watts = 65; d.HoursPerDay = 10; d.DaysPerMonth = 20; g.Children.Add(d); g.Children.Add(d); listItem(g); Assert.Equal(26.0, g.UnitsPerMonth); }