Example #1
0
 /// <summary>
 /// Works with an <see cref="IQueryable{T}"/>
 /// </summary>
 /// <param name="queryable">The <see cref="IQueryable{T}"/></param>
 /// <param name="entities">The entity reader</param>
 /// <exception cref="ArgumentNullException">If queryable or entities are null</exception>
 public EntitySet(IQueryable <TEntity> queryable, IReadEntities entities)
 {
     if (queryable == null)
     {
         throw new ArgumentNullException("queryable");
     }
     if (entities == null)
     {
         throw new ArgumentNullException("entities");
     }
     Queryable = queryable;
     Entities  = entities;
 }
 public HandleRemoteMembershipsByUserQuery(IReadEntities entities)
 {
     _entities = entities;
 }
Example #3
0
 public HandleVerifyEmailSecretCommand(IWriteEntities entities)
 {
     _entities = entities;
 }
Example #4
0
 public HandleUserViewByQuery(IReadEntities entities)
 {
     _entities = entities;
 }
 public HandleCustomerEmployerMappingsWithIncludeByQuery(IReadEntities db, IMapper mapper)
 {
     _db     = db;
     _mapper = mapper;
 }
Example #6
0
 public HandleRemoteMembershipViewsByQuery(IReadEntities entities)
 {
     _entities = entities;
 }
Example #7
0
 public DataAccessService(DbContext context)
 {
     _readEntitiesImplementation  = new ReadEntities(context);
     _writeEntitiesImplementation = new WriteEntities(context);
     _operationProcessor          = new OperationProcessor();
 }
Example #8
0
 public HandleLocalMembershipByVerifiedEmailQuery(IReadEntities entities)
 {
     _entities = entities;
 }
Example #9
0
 public HandleEmailVerificationByQuery(IReadEntities entities)
 {
     _entities = entities;
 }
Example #10
0
 public HandleUserHasLocalMembershipQuery(IReadEntities entities)
 {
     _entities = entities;
 }
Example #11
0
 public HandleEmailAddressByQuery(IReadEntities entities)
 {
     _entities = entities;
 }
Example #12
0
 public HandleCustomerByQuery(IReadEntities db, IMapper mapper)
 {
     _db     = db;
     _mapper = mapper;
 }
Example #13
0
 public HandlePersonByQuery(IReadEntities db)
 {
     _db = db;
 }
Example #14
0
 public HandleLocalMembershipByUserQuery(IReadEntities entities)
 {
     _entities = entities;
 }
Example #15
0
 public HandleAddressByQuery(IReadEntities db, IMapper mapper)
 {
     _db     = db;
     _mapper = mapper;
 }
        public GetCustomerEmployerMappings()
        {
            _readDb = Substitute.For <IReadEntities>();
            _mapper = new MapperConfiguration(c =>
                                              c.AddProfiles(
                                                  new List <Profile>
            {
                new CommandToEntityProfile(),
                new EntityToViewProfile(),
            }
                                                  ))
                      .CreateMapper();

            var anAddress = new Address
            {
                Id         = 1,
                Street     = "street",
                Suburb     = "suburb",
                State      = "state",
                Country    = "country",
                PostalCode = "postcode",
            };

            _addresses = new List <Address>()
            {
                anAddress
            };
            var mockAddressQueryable = _addresses.AsQueryable().BuildMock();

            _readDb.Query <Address>().Returns(mockAddressQueryable);

            var aCust = new Customer
            {
                Id           = 101,
                FirstName    = "first name",
                LastName     = "last name",
                EmailAddress = "my.email@address",
                AddressId    = anAddress.Id
            };

            _customers = new List <Customer>()
            {
                aCust
            };
            var mockCustomerQueryable = _customers.AsQueryable().BuildMock();

            _readDb.Query <Customer>().Returns(mockCustomerQueryable);
            //_readDb.Query<Customer>(Arg.Any<IEnumerable<Expression<Func<Customer, object>>>>()).Returns(mockCustomerQueryable);

            var anEmp = new Employer
            {
                Id   = 1001,
                Name = "employer",
            };

            _employers = new List <Employer>()
            {
                anEmp
            };
            var mockEmployerQueryable = _employers.AsQueryable().BuildMock();

            _readDb.Query <Employer>().Returns(mockEmployerQueryable);

            var aMapping = new CustomerEmployerMapping
            {
                Id         = 999,
                CustomerId = aCust.Id,
                EmployerId = anEmp.Id
            };

            _customerEmployerMappings = new List <CustomerEmployerMapping>()
            {
                aMapping
            };
            var mockCustomerEmployerMappingQueryable = _customerEmployerMappings.AsQueryable().BuildMock();

            _readDb.Query <CustomerEmployerMapping>().Returns(mockCustomerEmployerMappingQueryable);
        }