public CommandTestBase() { _mediatorMock = new Mock <IMediator>(); _currentUserMock = new Mock <ICurrentUserService>(); _userManagerMock = new Mock <IUserManager>(); _dateTime = new DateTime(3001, 1, 1); _dateTimeMock = new Mock <IDateTime>(); _dateTimeMock.Setup(m => m.Now).Returns(_dateTime); _context = ShowcaseContextFactory.Create(_currentUserMock.Object, _dateTimeMock.Object); }
public static ShowcaseDbContext Create(ICurrentUserService currentUserService, IDateTime dateTime) { var options = new DbContextOptionsBuilder <ShowcaseDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; var context = new ShowcaseDbContext(options, currentUserService, dateTime); context.Database.EnsureCreated(); context.Profiles.AddRange(new[] { new ShowcaseProfile { ProfileId = "HAMZA", Username = "******", Email = "*****@*****.**", Name = "Hamza Rahimy" }, new ShowcaseProfile { ProfileId = "JASON", Username = "******", Email = "*****@*****.**", Name = "Jason Taylor" }, new ShowcaseProfile { ProfileId = "ELON", Username = "******", Email = "*****@*****.**", Name = "Elon Musk" } }); context.DisplayProjects.Add(new DisplayProject { Id = "SHOWCASE", Name = "Showcase Portfolios", SourceCodeUrl = "https://github.com/HRahimy/showcase" }); context.BucketFiles.Add(new BucketFile { BucketFileId = "hamzaProfileImage1", Uploaded = true, }); context.SaveChanges(); return(context); }
public GetDevelopersListQueryHandlerTests(QueryTestFixture fixture) { _context = fixture.Context; _mapper = fixture.Mapper; }
public static void Destroy(ShowcaseDbContext context) { context.Database.EnsureDeleted(); context.Dispose(); }