Ejemplo n.º 1
0
        public void TestAddDataPointHistoryData()
        {
            IUnitOfWork unitOfWork = new AdoUnitOfWork();
            IDataPointHistoryDataRepository dataPointHistoryDataRepository = new DataPointHistoryDataRepository(unitOfWork);

            DataPointHistoryDataService dataPointHistoryDataService
                = new DataPointHistoryDataService(dataPointHistoryDataRepository,
                                                  unitOfWork);

            List <DataPointHistoryData> dataPointHistoryDatas = new List <DataPointHistoryData>();

            for (int i = 0; i < 5000; i++)
            {
                DataPointHistoryData dataPointHistoryData = new DataPointHistoryData()
                {
                    Id        = Guid.NewGuid().ToString("D"),
                    DataPoint = new DataPoint()
                    {
                        Id = 1726
                    },
                    DateTime = DateTime.Now,
                    Value    = 123456789.12345
                };

                dataPointHistoryDatas.Add(dataPointHistoryData);
            }

            AddDataPointHistoryDataRequst requst = new AddDataPointHistoryDataRequst();

            requst.DataPointHistoryDatasToAdd = dataPointHistoryDatas;

            AddDataPointHistoryDataResponse response =
                dataPointHistoryDataService.AddDataPointHistoryData(requst);
        }
Ejemplo n.º 2
0
        public void TestInitializeTimer()
        {
            IUnitOfWork unitOfWork = new AdoUnitOfWork();
            IDataPointHistoryDataRepository dataPointHistoryDataRepository = new DataPointHistoryDataRepository(unitOfWork);

            DataPointHistoryDataService dataPointHistoryDataService
                = new DataPointHistoryDataService(dataPointHistoryDataRepository,
                                                  unitOfWork);

            //dataPointHistoryDataService.DelecteDataPointHistoryValue();
        }
Ejemplo n.º 3
0
        public void TestDelecteDataPointHistoryValue()
        {
            IUnitOfWork unitOfWork = new AdoUnitOfWork();
            IDataPointHistoryDataRepository dataPointHistoryDataRepository = new DataPointHistoryDataRepository(unitOfWork);

            DataPointHistoryDataService dataPointHistoryDataService
                = new DataPointHistoryDataService(dataPointHistoryDataRepository,
                                                  unitOfWork);

            dataPointHistoryDataService.DelecteDataPointHistoryValueBefore(0);
        }
        public void TestFindByQuery()
        {
            AdoUnitOfWork unitOfWork = new AdoUnitOfWork();
            DataPointHistoryDataRepository dataPointHistoryDataRepository = new DataPointHistoryDataRepository(unitOfWork);

            Query query = new Query();

            query.AddCriterion(Criterion.Create <DataPointHistoryData>(p => p.DataPoint.Id, 1, CriteriaOperator.Equal));
            query.AddCriterion(Criterion.Create <DataPointHistoryData>(p => p.DateTime, new DateTime(2013, 5, 1), CriteriaOperator.GreaterThanOrEqual));
            query.AddCriterion(Criterion.Create <DataPointHistoryData>(p => p.DateTime, DateTime.Now, CriteriaOperator.LesserThanOrEqual));
            query.QueryOperator   = QueryOperator.And;
            query.OrderByProperty = OrderByClause.Create <DataPointHistoryData>(p => p.DateTime, false);

            IEnumerable <DataPointHistoryData> result = dataPointHistoryDataRepository.FindBy(query);

            Assert.IsTrue(result.Count() > 0);
        }
Ejemplo n.º 5
0
        public void TestGetAllDataPointsHistoryData()
        {
            IUnitOfWork                     unitOfWork                     = new AdoUnitOfWork();
            IDataPointRepository            dataPointRepository            = new DataPointRepository(unitOfWork);
            IDataPointHistoryDataRepository dataPointHistoryDataRepository = new DataPointHistoryDataRepository(unitOfWork);
            IModuleRepository               moduleRepository               = new ModuleRepository(unitOfWork);

            DataPointHistoryDataService dataPointHistoryDataService
                = new DataPointHistoryDataService(dataPointHistoryDataRepository,
                                                  unitOfWork);

            GetAllDataPointsHistoryDataResponse response = new GetAllDataPointsHistoryDataResponse();

            response = dataPointHistoryDataService.GetAllDataPointsHistoryData();

            Assert.True(response.ResponseSucceed);
        }
        public void CanAddDataPointHistoryData()
        {
            AdoUnitOfWork unitOfWork = new AdoUnitOfWork();
            DataPointHistoryDataRepository dataPointHistoryDataRepository = new DataPointHistoryDataRepository(unitOfWork);

            DataPointHistoryData dataPointHistoryData = new DataPointHistoryData()
            {
                Id        = Guid.NewGuid().ToString("D"),
                DataPoint = new DataPoint()
                {
                    Id = 1726
                },
                DateTime = DateTime.Now.AddDays(8),
                Value    = 123456789.12345
            };

            dataPointHistoryDataRepository.Add(dataPointHistoryData);
            unitOfWork.Commit();
        }
Ejemplo n.º 7
0
        public void TestRemoveDataPointHistoryDataByQuery()
        {
            IUnitOfWork unitOfWork = new AdoUnitOfWork();
            IDataPointHistoryDataRepository dataPointHistoryDataRepository = new DataPointHistoryDataRepository(unitOfWork);

            DataPointHistoryDataService dataPointHistoryDataService
                = new DataPointHistoryDataService(dataPointHistoryDataRepository,
                                                  unitOfWork);

            DeleteDataPointHistoryDataRequst requst = new DeleteDataPointHistoryDataRequst();

            requst.BeginTime = new DateTime(2013, 8, 3);
            requst.EndTime   = DateTime.Now;

            DeleteDataPointHistoryDataResponse response =
                dataPointHistoryDataService.DeleteDataPointHistoryData(requst);

            Assert.IsTrue(response.ResponseSucceed);
        }
Ejemplo n.º 8
0
        public void TestGetDataPiontHistoryData()
        {
            IUnitOfWork                     unitOfWork                     = new AdoUnitOfWork();
            IDataPointRepository            dataPointRepository            = new DataPointRepository(unitOfWork);
            IDataPointHistoryDataRepository dataPointHistoryDataRepository = new DataPointHistoryDataRepository(unitOfWork);
            IModuleRepository               moduleRepository               = new ModuleRepository(unitOfWork);

            DataPointHistoryDataService dataPointHistoryDataService =
                new DataPointHistoryDataService(dataPointHistoryDataRepository,
                                                unitOfWork);

            GetDataPointHistoryDataRequest  request  = new GetDataPointHistoryDataRequest();
            GetDataPiontHistoryDataResponse response = new GetDataPiontHistoryDataResponse();

            request.DataPointId = 1;
            request.BeginTime   = new DateTime();
            request.EndTime     = DateTime.Now;

            response = dataPointHistoryDataService.GetDataPiontHistoryData(request);

            Assert.True(response.ResponseSucceed);
        }