示例#1
0
 public void TestInitialize()
 {
     _mockGigs    = new Mock <DbSet <Gig> >();
     _mockContext = new  Mock <IApplicationDbContext>();
     _mockContext.SetupGet(c => c.Gigs).Returns(_mockGigs.Object);
     _repository = new GigRepository(_mockContext.Object);
 }
示例#2
0
 public UnitOfWork(ApplicationDbContext context)
 {
     _context   = context;
     Gigs       = new GigRepository(context);
     Attendance = new AttendanceRepository(context);
     Genre      = new GenreRepository(context);
 }
        public void IntialData()
        {
            _mockGig = new Mock <DbSet <Gig> >();
            var mockContext = new Mock <IApplicationDbContext>();

            mockContext.SetupGet(c => c.Gigs).Returns(_mockGig.Object);

            var mockArtist = new Mock <DbSet <ApplicationUser> >();
            var artist1    = new ApplicationUser {
                Id = "1", FullName = "Thao"
            };

            mockArtist.SetSource(new[] { artist1 });
            //   mockContext.SetupGet(c => c.Users).Returns(mockArtist.Object);


            var mockGener = new Mock <DbSet <Genre> >();
            var gener1    = new Genre {
                ID = 1, Name = "Cai luong"
            };

            mockGener.SetSource(new[] { gener1 });
            //    mockContext.SetupGet(c => c.Genres).Returns(mockGener.Object);


            _gigRepository = new GigRepository(mockContext.Object);
        }
示例#4
0
 public GigsController()
 {
     _context = new ApplicationDbContext();
     _attendanceRepository = new AttendanceRepository(_context);
     _gigRepository        = new GigRepository(_context);
     _genreRepository      = new GenreRepository(_context);
     _unitOfWork           = new UnitOfWork(_context);
 }
示例#5
0
 public void Initialize()
 {
     _gigs    = new Mock <DbSet <Gig> >();
     _context = new Mock <IApplicationDbContext>();
     _context.SetupGet(c => c.Gigs).Returns(_gigs.Object);
     _repository = new GigRepository(_context.Object);
     _artistId   = "1";
 }
示例#6
0
 public UnitOfWork(ApplicationDbContext db)
 {
     _db         = db;
     Gigs        = new GigRepository(db);
     Attendances = new AttendanceRepository(db);
     Followings  = new FollowingRepository(db);
     Genres      = new GenreRepository(db);
 }
        public void TestInitialize()
        {
            _mockDbSetGigs = new Mock <DbSet <Gig> >();

            _mockContext = new ApplicationDbContext();

            _repository = new GigRepository(_mockContext);
        }
示例#8
0
 public UnitOfWork(GigHubContext context)
 {
     _context    = context;
     Gigs        = new GigRepository(context);
     Attendances = new AttendanceRepository(context);
     Followings  = new FollowingRepository(context);
     Genres      = new GenreRepository(context);
 }
示例#9
0
 public GigsController()
 {
     db = new ApplicationDbContext();
     attendanceRepository = new AttendanceRepository(db);
     gigRepository        = new GigRepository(db);
     genreRepository      = new GenreRepository(db);
     followingRepository  = new FollowingRepository(db);
 }
示例#10
0
 public UnitOfWork(ApplicationDbContext context)
 {
     _context    = context;
     Gigs        = new GigRepository(_context);
     Attendances = new AttendanceRepository(_context);
     Genres      = new GenreRepository(_context);
     Follows     = new FollowingRepository(_context);
 }
示例#11
0
        public void Setup()
        {
            _gigRepository          = new GigRepository();
            _mongoDatabaseUtilities = new MongoDatabaseUtilities <Gig>("gigs");

            _testGigOne   = TestGigOne();
            _testGigTwo   = TestGigTwo();
            _testGigThree = TestGigThree();
        }
 public UnitOfWork(ApplicationDbContext context)
 {
     _context          = context;
     Attendance        = new AttendanceRepository(_context);
     Gigs              = new GigRepository(_context);
     Following         = new FollowingRepository(_context);
     Genres            = new GenreRepository(_context);
     UserNotifications = new UserNotificationRepository(_context);
 }
示例#13
0
 public UnitOfWork(ApplicationDbContext ctx)
 {
     _ctx          = ctx;
     Gigs          = new GigRepository(ctx);
     Genres        = new GenresRepository(ctx);
     Follows       = new FollowsRepository(ctx);
     Attedances    = new AttendanceRepository(ctx);
     Notifications = new NotificationsRepository(ctx);
 }
示例#14
0
 public UnitOfWork(ApplicationDbContext context)
 {
     _context     = context;
     Gigs         = new GigRepository(context);
     Attendance   = new AttendanceRepository(context);
     Genre        = new GenreRepository(context);
     Follow       = new FollowRepository(context);
     Notification = new NotificationRepository(context);
 }
示例#15
0
        public void TestInitialize()
        {
            _mockContext    = new Mock <IApplicationDbContext>();
            _mockGigs       = new Mock <DbSet <Gig> >();
            _mockAttendance = new Mock <DbSet <Attendance> >();


            _gigRepository        = new GigRepository(_mockContext.Object);
            _attendanceRepository = new AttendanceRepository(_mockContext.Object);
        }
示例#16
0
        public void TestInitialize()
        {
            _mockContext   = new Mock <IApplicationDbContext>();
            mockGig        = new Mock <DbSet <Gig> >();
            mockAtttendace = new Mock <DbSet <Attendance> >();
            _mockContext.SetupGet(r => r.Gigs).Returns(() => mockGig.Object);
            _mockContext.SetupGet(r => r.Attendances).Returns(() => mockAtttendace.Object);

            _gigRepository = new GigRepository(_mockContext.Object);
        }
        public void TestInitialize()
        {
            _mockGigs       = new Mock <DbSet <Gig> >();
            _mockAttendence = new Mock <DbSet <Attendence> >();
            var mockContext = new Mock <IApplicationDbContext>();

            mockContext.Setup(g => g.Gigs).Returns(_mockGigs.Object);
            mockContext.Setup(g => g.Attendences).Returns(_mockAttendence.Object);
            _repository = new GigRepository(mockContext.Object);
        }
示例#18
0
        public void SetUp()
        {
            _mockGigs = new Mock <DbSet <Gig> >();

            var mockContext = new Mock <IApplicationDbContext>();

            mockContext.SetupGet(c => c.Gigs).Returns(_mockGigs.Object);

            _repository = new GigRepository(mockContext.Object);
        }
示例#19
0
 public UnitOfWork(ApplicationDbContext context)
 {
     _context      = context;
     Attendances   = new AttendanceRepository(_context);
     FollowUps     = new FollowUpRepository(_context);
     Gigs          = new GigRepository(_context);
     Inboxes       = new InboxRepository(_context);
     Notifications = new NotificationRepository(_context);
     Users         = new UserRepository(_context);
 }
示例#20
0
 public UnitOfWork(ApplicationDbContext dbContext)
 {
     _dbContext        = dbContext;
     Gigs              = new GigRepository(dbContext);
     Attendances       = new AttendanceRepository(dbContext);
     Genres            = new GenreRepository(dbContext);
     Followings        = new FollowingRepository(dbContext);
     UserNotifications = new UserNotificationRepository(dbContext);
     Notifications     = new NotificationRepository(dbContext);
 }
示例#21
0
 public UnitOfWork(ApplicationDbContext _db)
 {
     db                         = _db;
     gigRepository              = new GigRepository(db);
     applicationUserRepository  = new ApplicationUserRepository(db);
     genreRepository            = new GenreRepository(db);
     relationshipRepository     = new RelationshipRepository(db);
     attendancesRepository      = new AttendancesRepository(db);
     notificationsRepository    = new NotificationsRepository(db);
     userNotificationRepository = new UserNotificationRepository(db);
 }
 public UnitOfWork(ApplicationDbContext context)
 {
     _context          = context;
     Gigs              = new GigRepository(context);
     Attendances       = new AttendanceRepository(context);
     Follows           = new FollowRepository(context);
     Genres            = new GenreRepository(context);
     Users             = new ApplicationUserRepository(context);
     Notifications     = new NotificationRepository(context);
     UserNotifications = new UserNotificationRepository(context);
 }
示例#23
0
 public UnitOfWork(ApplicationDbContext context)
 {
     _context          = context;
     Gigs              = new GigRepository(_context);
     Attendances       = new AttendanceRepository(_context);
     Genres            = new GenreRepository(_context);
     Relationships     = new RelationshipRepository(_context);
     Users             = new UserRepository(_context);
     UserNotifications = new UserNotificationRepository(_context);
     Notification      = new NotificationRepository(_context);
 }
示例#24
0
 public UnitOfWork(ApplicationDbContext context)
 {
     _context     = context;
     Gigs         = new GigRepository(_context);
     Attendence   = new AttendenceRepository(_context);
     Following    = new FollowingRepository(_context);
     Genre        = new GenreRepository(_context);
     Notification = new NotificationRepository(_context);
     Composition  = new CompositionRepository(_context);
     Artist       = new ArtistRepository(_context);
 }
示例#25
0
        public void TestInitialize()
        {
            _mockGigs        = new Mock <DbSet <Gig> >();
            _mockAttendances = new Mock <DbSet <Attendance> >();

            var mockContext = new Mock <IGigHubContext>();

            mockContext.SetupGet(c => c.Gigs).Returns(_mockGigs.Object);
            mockContext.SetupGet(c => c.Attendances).Returns(_mockAttendances.Object);

            _repository = new GigRepository(mockContext.Object);
        }
示例#26
0
        public void TestInitialize()
        {
            _userId         = "1";
            _mockGig        = new Mock <DbSet <Gig> >();
            _mockAttendance = new Mock <DbSet <Attendance> >();

            var mockContext = new Mock <IApplicationDbContext>();

            mockContext.SetupGet(a => a.Gigs).Returns(_mockGig.Object);
            mockContext.SetupGet(a => a.Attendances).Returns(_mockAttendance.Object);

            _repository = new GigRepository(mockContext.Object);
        }
示例#27
0
        // public IUserDescriptionRepository UserDescriptions { get; }

        public UnitOfWork(ApplicationDbContext context)
        {
            _context          = context;
            Gigs              = new GigRepository(_context);
            Attendances       = new AttendanceRepository(_context);
            Followings        = new FollowingRepository(_context);
            Genres            = new GenreRepository(_context);
            UserNotifications = new UserNotificationRepository(_context);
            Users             = new UserRepository(_context);
            Roles             = new RoleRepository(_context);
            Logins            = new LoginRepository(_context);
            //  UserDescriptions = new UserDescriptionRepository(_context);
        }
示例#28
0
        public void TestInitialize()
        {
            _mockGigs        = new Mock <DbSet <Gig> >();
            _mockAttendances = new Mock <DbSet <Attendance> >();

            var mockContext = new Mock <IApplicationDbContext>();

            //Note the introduction of () => in the line of code marked with (*).
            //This effectively means that the return value gets lazily evaluated,
            //the lines marked with (1) and (2) will end up running first.
            //We need lazily evaluate in new version moq. ( after 4.7)
            mockContext.SetupGet(c => c.Gigs).Returns(() => _mockGigs.Object);
            mockContext.SetupGet(c => c.Attendances).Returns(() => _mockAttendances.Object);

            _repository = new GigRepository(mockContext.Object);
        }
示例#29
0
        public void TestInitialize()
        {
            _mockGigs = new Mock <DbSet <Gig> >();
            //_mockAttendances = new Mock<DbSet<Attendance>>();

            //LD by creating the interface "IApplicationDbContext" I can mock it
            // AND PASS IT to the "new GigRepository"
            var mockContext = new Mock <IApplicationDbContext>();


            //LD When from the context we go to "Gigs" we have to return "_mockGigs"
            mockContext.SetupGet(c => c.Gigs).Returns(_mockGigs.Object);


            //mockContext.SetupGet(c => c.Attendances).Returns(_mockAttendances.Object);
            _repository = new GigRepository(mockContext.Object);
        }
示例#30
0
        public void TestInitialize()
        {
            var mockContext = new Mock <IApplicationDbContext>();

            _mockGigs            = new Mock <DbSet <Gig> >();
            _mockAttendances     = new Mock <DbSet <Attendance> >();
            _userId              = "1";
            _futureGigWithUserId = new Gig()
            {
                Id       = 1,
                DateTime = DateTime.Now.AddDays(+1),
                ArtistId = _userId,
                Artist   = new ApplicationUser(),
                Genre    = new Genre()
            };

            mockContext.SetupGet(c => c.Gigs).Returns(_mockGigs.Object);
            mockContext.SetupGet(c => c.Attendances).Returns(_mockAttendances.Object);

            _repository = new GigRepository(mockContext.Object);
        }