Exemplo n.º 1
0
        public void DeleteTest()
        {
            dc v = new dc();

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                context.Set <dc>().Add(v);
                context.SaveChanges();
            }

            PartialViewResult rv = (PartialViewResult)_controller.Delete(v.ID.ToString());

            Assert.IsInstanceOfType(rv.Model, typeof(dcVM));

            dcVM vm = rv.Model as dcVM;

            v         = new dc();
            v.ID      = vm.Entity.ID;
            vm.Entity = v;
            _controller.Delete(v.ID.ToString(), null);

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                Assert.AreEqual(context.Set <dc>().Count(), 0);
            }
        }
Exemplo n.º 2
0
        public void EditTest()
        {
            dc v = new dc();

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                context.Set <dc>().Add(v);
                context.SaveChanges();
            }

            PartialViewResult rv = (PartialViewResult)_controller.Edit(v.ID.ToString());

            Assert.IsInstanceOfType(rv.Model, typeof(dcVM));

            dcVM vm = rv.Model as dcVM;

            v    = new dc();
            v.ID = vm.Entity.ID;

            vm.Entity = v;
            vm.FC     = new Dictionary <string, object>();

            _controller.Edit(vm);

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                var data = context.Set <dc>().FirstOrDefault();

                Assert.AreEqual(data.UpdateBy, "user");
                Assert.IsTrue(DateTime.Now.Subtract(data.UpdateTime.Value).Seconds < 10);
            }
        }
Exemplo n.º 3
0
        public void BatchDeleteTest()
        {
            dc v1 = new dc();
            dc v2 = new dc();

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                context.Set <dc>().Add(v1);
                context.Set <dc>().Add(v2);
                context.SaveChanges();
            }

            PartialViewResult rv = (PartialViewResult)_controller.BatchDelete(new string[] { v1.ID.ToString(), v2.ID.ToString() });

            Assert.IsInstanceOfType(rv.Model, typeof(dcBatchVM));

            dcBatchVM vm = rv.Model as dcBatchVM;

            vm.Ids = new string[] { v1.ID.ToString(), v2.ID.ToString() };
            _controller.DoBatchDelete(vm, null);

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                Assert.AreEqual(context.Set <dc>().Count(), 0);
            }
        }
Exemplo n.º 4
0
        private Guid AddDC()
        {
            dc v = new dc();

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                context.Set <dc>().Add(v);
                context.SaveChanges();
            }
            return(v.ID);
        }
Exemplo n.º 5
0
        public void DetailsTest()
        {
            dc v = new dc();

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                context.Set <dc>().Add(v);
                context.SaveChanges();
            }
            PartialViewResult rv = (PartialViewResult)_controller.Details(v.ID.ToString());

            Assert.IsInstanceOfType(rv.Model, typeof(IBaseCRUDVM <TopBasePoco>));
            Assert.AreEqual(v.ID, (rv.Model as IBaseCRUDVM <TopBasePoco>).Entity.GetID());
        }
Exemplo n.º 6
0
        public void CreateTest()
        {
            PartialViewResult rv = (PartialViewResult)_controller.Create();

            Assert.IsInstanceOfType(rv.Model, typeof(dcVM));

            dcVM vm = rv.Model as dcVM;
            dc   v  = new dc();

            vm.Entity = v;
            _controller.Create(vm);

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                var data = context.Set <dc>().FirstOrDefault();

                Assert.AreEqual(data.CreateBy, "user");
                Assert.IsTrue(DateTime.Now.Subtract(data.CreateTime.Value).Seconds < 10);
            }
        }
Exemplo n.º 7
0
 public searchRetrieveResponseRecordsRecordRecordData(JstorService.searchRetrieveResponseRecordsRecordRecordData other)
 {
     dc = new dc(other);
 }
Exemplo n.º 8
0
		assertNull(dc.getCacheTree(false));
Exemplo n.º 9
0
 // Start a dialog after proactive message was sent to user
 await BeginDialogAfterMessageAsync(dc, message, cancellationToken);
Exemplo n.º 10
0
        private void 显示单词ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            dc dc = new dc();

            dc.Show();
        }
Exemplo n.º 11
0
 Switch(dc, wish);