12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- using System;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using iBemsDataService.Controllers;
- using System.Net.Http;
- using System.Web.Http;
- using System.Web.Http.Routing;
- using System.Diagnostics;
- namespace iBemsDataService.Tests
- {
- [TestClass]
- public class TestBemsFormulaController
- {
- [TestMethod]
- public void TestFormulaCalculation()
- {
- try
- {
- var controller = new BemsFormulaController();
- controller.Request = new HttpRequestMessage
- {
- //RequestUri = new Uri( "http://localhost:3403/api/BemsFormula/Calculation" +
- // "?SiteId=1&FacilityTypeId=1&FacilityCode=1&FormulaId=1" +
- // "&TimeIntervalType=1&StartDate=2014-11-04 00:00&EndDate=2014-11-05 11:45" ) ,
- //RequestUri = new Uri( "http://localhost:3403/api/BemsFormula/Calculation?&FacilityTypeId=26&FacilityCode=3&FormulaId=1&TimeIntervalType=4&StartDate=2014-01-01%2000:00:00&EndDate=2014-12-16%2018:57:37&SiteId=1" ) ,
- // RequestUri = new Uri( "http://localhost:3403/api/BemsFormula/Calculation?&FacilityTypeId=24&FacilityCode=1&FormulaId=1&TimeIntervalType=2&StartDate=2014-12-21%2000:00:00&EndDate=2014-12-21%2023:59:59&SiteId=1" ) ,
- RequestUri = new Uri( "http://localhost:3403/api/BemsFormula/Calculation?&FacilityTypeId=24&FacilityCode=1&FormulaId=1&TimeIntervalType=2&StartDate=2014-12-15%2000:00:00&EndDate=2014-12-15%2023:59:59&SiteId=1" ) ,
- };
- controller.Configuration = new HttpConfiguration();
- var list = controller.GetBemsFormula();
- foreach( var v in list )
- {
- Trace.WriteLine( string.Format( "{0} {1} - {2}" ,
- v.DateTime.ToShortDateString() ,
- v.DateTime.ToShortTimeString() ,
- v.Value ));
- }
- Assert.IsTrue( true );
- }
- catch( Exception e )
- {
- Trace.WriteLine( e.Message );
- throw e;
- }
- }
- }
- }
|