public CommandQueryTestFixture()
        {
            var mockDateTime = new Mock <IDateTimeProvider>();

            mockDateTime.Setup(dtp => dtp.Now).Returns(new DateTime(3000, 1, 1));
            DateTimeProvider = mockDateTime.Object;

            Context = RsDbContextFactory.Create();
        }
Exemple #2
0
        public static RsTestDbContext Create()
        {
            var options = new DbContextOptionsBuilder <RsTestDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString())
                          .Options;

            var context = new RsTestDbContext(options);

            context.Database.EnsureCreated();

            context.SaveChanges();

            return(context);
        }
Exemple #3
0
        public static void Destory(RsTestDbContext context)
        {
            context.Database.EnsureDeleted();

            context.Dispose();
        }