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); } }
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); } }
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); } }
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); }
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()); }
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); } }
public searchRetrieveResponseRecordsRecordRecordData(JstorService.searchRetrieveResponseRecordsRecordRecordData other) { dc = new dc(other); }
assertNull(dc.getCacheTree(false));
// Start a dialog after proactive message was sent to user await BeginDialogAfterMessageAsync(dc, message, cancellationToken);
private void 显示单词ToolStripMenuItem_Click(object sender, EventArgs e) { dc dc = new dc(); dc.Show(); }
Switch(dc, wish);