Example #1
0
        public async Task SQLServer_User_Search_Test()
        {
            var data        = FakeUserData.GetList(20);
            var service     = GetService(data);
            var controller  = new SQLServer_UserSearchController(service);
            var criteriaDto = new UsersLookUpCriteriaDto
            {
                Name      = "Test1",
                Surname   = "Test1",
                Interests = new List <UserInterestDto> {
                    new UserInterestDto {
                        Id = 1
                    }
                }
            };
            var res = await controller.GetUsersByCriteria(1, criteriaDto, 7);

            var obj = res as OkObjectResult;

            Assert.NotNull(obj);
            var actData = obj.Value as List <UserDto>;

            Assert.NotNull(actData);
            Assert.True(actData.Count == 1);
        }
Example #2
0
        public void Setup()
        {
            _WeeklyMenuFactory = new FakeWeeklyMenuFactory();
            _DishFactory       = new FakeDishFactory();
            var session = new Mock <ISession>();

            _httpContext = new Mock <HttpContext>();
            _httpContext.Setup(x => x.Session).Returns(session.Object);

            _userData           = new FakeUserData();
            _userData.sessionId = Guid.NewGuid().ToString();
        }
Example #3
0
 private IEnumerable <EventAdmins> GetFakeData(int i)
 {
     for (var j = 1; j < i; j++)
     {
         yield return new EventAdmins
                {
                    Id      = j,
                    EventId = _eventId,
                    UserId  = j,
                    Event   = FakeEventData.CreateById(_eventId,
                                                       _userId),
                    User = FakeUserData.CreateById(j)
                }
     }
     ;
 }
Example #4
0
        private static Mock <IWorkUnit> GetUnit()
        {
            var mockTransaction = new Mock <IDbContextTransaction>();

            mockTransaction.Setup(x => x.Commit()).Verifiable();
            mockTransaction.Setup(x => x.Rollback()).Verifiable();

            var workUnit = new Mock <IWorkUnit>();

            workUnit.SetupGet(x => x.VenueRepository).Returns(new FakeRepository <Venue>(FakeVenueData.Venues()));
            workUnit.SetupGet(x => x.LayoutRepository).Returns(new FakeRepository <Layout>(FakeVenueData.Layouts()));
            workUnit.SetupGet(x => x.AreaRepository).Returns(new FakeRepository <Area>(FakeVenueData.Areas()));
            workUnit.SetupGet(x => x.SeatRepository).Returns(new FakeRepository <Seat>(FakeVenueData.Seats()));
            workUnit.SetupGet(x => x.EventRepository).Returns(new FakeRepository <Event>(FakeEventData.Events()));
            workUnit.SetupGet(x => x.EventAreaRepository).Returns(new FakeRepository <EventArea>(FakeEventData.EventAreas()));
            workUnit.SetupGet(x => x.EventSeatRepository).Returns(new FakeRepository <EventSeat>(FakeEventData.EventSeats()));
            workUnit.SetupGet(x => x.UserRepository).Returns(new FakeRepository <User>(FakeUserData.Users()));
            workUnit.SetupGet(x => x.OrderedSeatsRepository).Returns(new FakeRepository <OrderedSeat>(FakeUserData.OrderedSeats()));
            workUnit.SetupGet(x => x.OrderRepository).Returns(new FakeRepository <Order>(FakeUserData.Orders()));
            workUnit.SetupGet(x => x.PurchasedSeatRepository).Returns(new FakeRepository <PurchasedSeat>(FakeUserData.PurchasedSeats()));
            workUnit.SetupGet(x => x.RoleRepository).Returns(new FakeRepository <Role>(FakeUserData.Roles()));
            workUnit.SetupGet(x => x.UserRoleRepository).Returns(new FakeRepository <UserRole>(FakeUserData.UserRoles()));
            workUnit.SetupGet(x => x.CartRepository).Returns(new FakeRepository <Cart>(FakeUserData.Carts()));
            workUnit.Setup(x => x.Save()).Verifiable();
            workUnit.Setup(x => x.SaveAsync()).Returns(Task.FromResult(0));
            workUnit.Setup(x => x.CreateTransaction()).Returns(mockTransaction.Object);

            return(workUnit);
        }