Esempio n. 1
0
        public void CreateTest()
        {
            SchoolVM vm = _controller.Wtm.CreateVM <SchoolVM>();
            School   v  = new School();

            v.SchoolCode = "G15";
            v.SchoolName = "I8KN8vsf2";
            v.SchoolType = Ray.BiliBiliToolPro.AdminWeb.Model.SchoolTypeEnum.PUB;
            v.Remark     = "cRS";
            vm.Entity    = v;
            var rv = _controller.Add(vm);

            Assert.IsInstanceOfType(rv, typeof(OkObjectResult));

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                var data = context.Set <School>().Find(v.ID);

                Assert.AreEqual(data.SchoolCode, "G15");
                Assert.AreEqual(data.SchoolName, "I8KN8vsf2");
                Assert.AreEqual(data.SchoolType, Ray.BiliBiliToolPro.AdminWeb.Model.SchoolTypeEnum.PUB);
                Assert.AreEqual(data.Remark, "cRS");
                Assert.AreEqual(data.CreateBy, "user");
                Assert.IsTrue(DateTime.Now.Subtract(data.CreateTime.Value).Seconds < 10);
            }
        }