コード例 #1
0
ファイル: DeviceFact.cs プロジェクト: win05178/Demo
            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);
            }
コード例 #2
0
ファイル: DeviceFact.cs プロジェクト: win05178/Demo
            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);
            }
コード例 #3
0
ファイル: DeviceFact.cs プロジェクト: win05178/Demo
            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);
            }
コード例 #4
0
ファイル: DeviceFacts.cs プロジェクト: Vatcharm/Demo
            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);
            }
コード例 #5
0
ファイル: DeviceGroupFacts.cs プロジェクト: Monchit/Demo
            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);
            }
コード例 #6
0
ファイル: DeviceGroupFacts.cs プロジェクト: win05178/Demo
            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);
            }