Exemple #1
0
        public void T_app_CheckExistData2()
        {
            Uri uri     = new Uri(TestConfig.serviceUrl);
            var context = new DamServiceRef.Container(uri);

            context.Format.UseJson();

            var app = context.Apps.Where(s => s.AppName == "第一支仪器").SingleOrDefault();


            context.LoadProperty <AppParam>(app, "AppParams", null);

            //添加测量参数

            DateTimeOffset date = DateTimeOffset.Now;

            List <MessureValue> list = new List <MessureValue>();

            foreach (var param in app.AppParams.OfType <MessureParam>())
            {
                var item = new MessureValue()
                {
                    Id      = Guid.NewGuid(),
                    Date    = date,
                    ParamId = param.Id,
                    Val     = 1
                };
                list.Add(item);
                context.AddToMessureValues(item);
            }


            context.SaveChanges();

            var result = context.CheckExistData(app.Id, date);

            Assert.AreEqual(true, result, "测试失败");

            foreach (var item in list)
            {
                context.DeleteObject(item);
            }



            context.SaveChanges();

            result = context.CheckExistData(app.Id, date);

            Assert.AreEqual(false, result, "测试失败");
        }
Exemple #2
0
        public void T_app_CheckExistData()
        {
            Uri uri     = new Uri(TestConfig.serviceUrl);
            var context = new DamServiceRef.Container(uri);

            context.Format.UseJson();

            var app = context.Apps.Where(s => s.AppName == "第一支仪器").SingleOrDefault();

            var result = context.CheckExistData(app.Id, DateTimeOffset.Now);

            Assert.AreEqual(false, result, "测试失败");
        }