Beispiel #1
0
        public EntityShould()
        {
            var now = DateTime.UtcNow;

            _session = Substitute.For <ISession>();
            _session.Clock.UtcNow.Returns(now);
            _session.User.Returns(SystemUser.Create("test_user"));
        }
Beispiel #2
0
        protected TestBase()
        {
            _constClock = Substitute.For <IClock>();
            _constClock.UtcNow.Returns(DateTime.UtcNow);

            Session = Substitute.For <ISession>();
            Session.User.Returns(x => SystemUser.Create(GetType().FullName));
            Session.Clock.Returns(x => Clock());
        }
Beispiel #3
0
        protected override void Seed(BackgroundDbContext context)
        {
            var migrationCreateDate = new DateTime(2019, 4, 24);
            //Role

            var manager = SystemRole.Create("管理人员", "系统管理员", UserIdProvider.Admin,
                                            migrationCreateDate);

            manager.ForceId(RoleIdProvider.Manager);
            context.SystemRoleContext.AddOrUpdate(manager);

            //用户
            if (!context.SystemUserContext.Any(x => x.Email == "*****@*****.**"))
            {
                var user = SystemUser.Create("Admin", "*****@*****.**", "Password1", RoleIdProvider.Manager,
                                             UserStatus.Enable, migrationCreateDate);
                user.ForceId(UserIdProvider.Admin);
                context.SystemUserContext.AddOrUpdate(user);
            }
        }