public void TestFromServer() { try { var client = new CubePower.Monitoring.KansaiClient(); Assert.AreEqual(CubePower.Monitoring.Area.Kansai, client.Area); var response = client.GetResponse(DateTime.Now); Assert.NotNull(response); } catch (Exception err) { Assert.Fail(err.ToString()); } }
public void TestFromFile() { try { var client = new CubePower.Monitoring.KansaiClient(); Assert.AreEqual(CubePower.Monitoring.Area.Kansai, client.Area); var filename = "kansai.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(1416, response.Usage); Assert.AreEqual(2500, response.Capacity); Assert.AreEqual(57, 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(6, response.Time.Minute); Assert.AreEqual(0, response.Time.Second); Assert.AreEqual("万kW", response.Unit); Assert.AreEqual(1857, response.Usage); Assert.AreEqual(2500, response.Capacity); Assert.AreEqual(74, 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()); } }