Exemplo n.º 1
0
        public void TestFromServer()
        {
            try
            {
                var client = new CubePower.Monitoring.KyushuClient();
                Assert.AreEqual(CubePower.Monitoring.Area.Kyushu, client.Area);

                var response = client.GetResponse(DateTime.Now);
                Assert.NotNull(response);

                response = client.GetResponse(DateTime.Now.AddDays(-1));
                Assert.NotNull(response);
            }
            catch (Exception err) { Assert.Fail(err.ToString()); }
        }
Exemplo n.º 2
0
        public void TestFromFile()
        {
            try
            {
                var client = new CubePower.Monitoring.KyushuClient();
                Assert.AreEqual(CubePower.Monitoring.Area.Kyushu, client.Area);

                var filename = "kyushu.csv";
                var time     = new DateTime(2013, 6, 4, 00, 00, 00);
                var response = GetResponseHelper.Run(client, filename, time);
                Assert.AreEqual(2013, response.Time.Year);
                Assert.AreEqual(6, response.Time.Month);
                Assert.AreEqual(4, response.Time.Day);
                Assert.AreEqual(0, response.Time.Hour);
                Assert.AreEqual(0, response.Time.Minute);
                Assert.AreEqual(0, response.Time.Second);
                Assert.AreEqual("万kW", response.Unit);
                Assert.AreEqual(818, response.Usage);
                Assert.AreEqual(1280, response.Capacity);
                Assert.AreEqual(64, response.UsageRatio);

                time     = new DateTime(2013, 6, 4, 12, 08, 00);
                response = GetResponseHelper.Run(client, filename, time);
                Assert.AreEqual(2013, response.Time.Year);
                Assert.AreEqual(6, response.Time.Month);
                Assert.AreEqual(4, response.Time.Day);
                Assert.AreEqual(12, response.Time.Hour);
                Assert.AreEqual(5, response.Time.Minute);
                Assert.AreEqual(0, response.Time.Second);
                Assert.AreEqual("万kW", response.Unit);
                Assert.AreEqual(1059, response.Usage);
                Assert.AreEqual(1280, response.Capacity);
                Assert.AreEqual(83, response.UsageRatio);

                time     = new DateTime(2013, 6, 3, 12, 08, 00);
                response = GetResponseHelper.Run(client, filename, time);
                Assert.IsNull(response);
            }
            catch (Exception err) { Assert.Fail(err.ToString()); }
        }