Esempio n. 1
0
            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);
            }
Esempio n. 2
0
            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);
            }
Esempio n. 3
0
            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);
            }
Esempio n. 4
0
            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);
            }
Esempio n. 5
0
            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);
            }
Esempio n. 6
0
            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);
            }