Ejemplo n.º 1
0
        public void CreateTest()
        {
            FrameworkUserVM   vm = _controller.CreateVM <FrameworkUserVM>();
            FrameworkUserBase v  = new FrameworkUserBase();

            v.ITCode   = "itcode";
            v.Name     = "name";
            v.Password = "******";
            vm.Entity  = v;
            var rv = _controller.Add(vm);

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

            using (var context = new FrameworkContext(_seed, DBTypeEnum.Memory))
            {
                var data = context.Set <FrameworkUserBase>().FirstOrDefault();
                Assert.AreEqual(data.ITCode, "itcode");
                Assert.AreEqual(data.Name, "name");
                Assert.AreEqual(data.Password, Utils.GetMD5String("password"));
                Assert.AreEqual(data.CreateBy, "user");
                Assert.IsTrue(DateTime.Now.Subtract(data.CreateTime.Value).Seconds < 10);
            }
        }