예제 #1
0
        public GroupMemberTests()
        {
            mockUnitOfWork = new Mock <BLL.IUnitOfWork>();

            mockGroupMemberRepo = new Mock <Repository.IRepository <EF.GroupMember> >();
            var mockIQueryableGroupMember = new TestRepo().GroupMembers.AsQueryable().BuildMock();

            mockGroupMemberRepo.Setup(x => x.Entities).Returns(mockIQueryableGroupMember.Object);

            mockGroupRepo = new Mock <Repository.IRepository <EF.Group> >();
            var mockIQueryableGroup = new TestRepo().Groups.AsQueryable().BuildMock();

            mockGroupRepo.Setup(x => x.Entities).Returns(mockIQueryableGroup.Object);

            mockMemberRepo = new Mock <Repository.IRepository <EF.Member> >();
            var mockIQueryableMember = new TestRepo().Members.AsQueryable().BuildMock();

            mockMemberRepo.Setup(x => x.Entities).Returns(mockIQueryableMember.Object);

            mockUnitOfWork.Setup(x => x.GroupMemberRepository).Returns(mockGroupMemberRepo.Object);
            mockUnitOfWork.Setup(x => x.GroupRepository).Returns(mockGroupRepo.Object);
            mockUnitOfWork.Setup(x => x.MemberRepository).Returns(mockMemberRepo.Object);

            groupMemberBusiness = new BLL.GroupMember(mockUnitOfWork.Object);
            groupBusiness       = new BLL.Group(mockUnitOfWork.Object);
        }
예제 #2
0
        public AttendanceTests()
        {
            mockUnitOfWork = new Mock <BLL.IUnitOfWork>();

            mockAttendanceRepo = new Mock <Repository.IRepository <EF.Attendance> >();
            var mockIQueryableAttendance = new TestRepo().Attendances.AsQueryable().BuildMock();

            mockAttendanceRepo.Setup(x => x.Entities).Returns(mockIQueryableAttendance.Object);

            mockMemberRepo = new Mock <Repository.IRepository <EF.Member> >();
            var mockIQueryableMember = new TestRepo().Members.AsQueryable().BuildMock();

            mockMemberRepo.Setup(x => x.Entities).Returns(mockIQueryableMember.Object);

            mockEventRepo = new Mock <Repository.IRepository <EF.Event> >();
            var mockIQueryableEvent = new TestRepo().Events.AsQueryable().BuildMock();

            mockEventRepo.Setup(x => x.Entities).Returns(mockIQueryableEvent.Object);

            mockRegistrantRepo = new Mock <Repository.IRepository <EF.Registrant> >();
            var mockIQueryableRegistrant = new TestRepo().Registrants.AsQueryable().BuildMock();

            mockRegistrantRepo.Setup(x => x.Entities).Returns(mockIQueryableRegistrant.Object);

            mockUnitOfWork.Setup(x => x.AttendanceRepository).Returns(mockAttendanceRepo.Object);
            mockUnitOfWork.Setup(x => x.MemberRepository).Returns(mockMemberRepo.Object);
            mockUnitOfWork.Setup(x => x.EventRepository).Returns(mockEventRepo.Object);
            mockUnitOfWork.Setup(x => x.RegistrantRepository).Returns(mockRegistrantRepo.Object);

            attendanceBusiness = new BLL.Attendance(mockUnitOfWork.Object);
        }
예제 #3
0
        public GroupCategoryTests()
        {
            mockUnitOfWork = new Mock <BLL.IUnitOfWork>();

            mockGroupCategoryRepo = new Mock <Repository.IRepository <EF.GroupCategory> >();
            var mockIQueryableGroupCategory = new TestRepo().GroupCategories.AsQueryable().BuildMock();

            mockGroupCategoryRepo.Setup(x => x.Entities).Returns(mockIQueryableGroupCategory.Object);

            mockUnitOfWork.Setup(x => x.GroupCategoryRepository).Returns(mockGroupCategoryRepo.Object);

            groupCategoryBusiness = new BLL.GroupCategory(mockUnitOfWork.Object);
        }
예제 #4
0
        public EventTests()
        {
            mockUnitOfWork = new Mock <BLL.IUnitOfWork>();

            mockEventRepo = new Mock <Repository.IRepository <EF.Event> >();
            var mockIQueryableEvent = new TestRepo().Events.AsQueryable().BuildMock();

            mockEventRepo.Setup(x => x.Entities).Returns(mockIQueryableEvent.Object);

            mockUnitOfWork.Setup(x => x.EventRepository).Returns(mockEventRepo.Object);

            eventBusiness = new BLL.Event(mockUnitOfWork.Object);
        }
예제 #5
0
        public MemberTests()
        {
            mockUnitOfWork = new Mock <BLL.IUnitOfWork>();

            memberBusiness = new BLL.Member(mockUnitOfWork.Object);

            mockMemberRepo = new Mock <Repository.IRepository <EF.Member> >();
            // Create mockable IQueryable async
            // https://stackoverflow.com/questions/40476233/how-to-mock-an-async-repository-with-entity-framework-core/40491640
            var mockIQueryableMember = new TestRepo().Members.AsQueryable().BuildMock();

            mockMemberRepo.Setup(x => x.Entities).Returns(mockIQueryableMember.Object);

            mockUnitOfWork.Setup(x => x.MemberRepository).Returns(mockMemberRepo.Object);
        }