Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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;
 }
Esempio n. 4
0
        public static void Destroy(ShowcaseDbContext context)
        {
            context.Database.EnsureDeleted();

            context.Dispose();
        }