Example #1
0
        public override void Given()
        {
            SeedTestData();
            CreateMapper();

            SeedProviderAddress();

            _newAddress = new TlProviderAddress
            {
                TlProviderId     = TlProviders.First().Id,
                DepartmentName   = "New Dept",
                OrganisationName = "New Org",
                AddressLine1     = "New Line1",
                AddressLine2     = "New Line2",
                Town             = "New town",
                Postcode         = "A11, 7BB",
                IsActive         = true,
                CreatedBy        = "Test user",
                CreatedOn        = DateTime.UtcNow
            };

            AddProviderAddress(_newAddress);

            TlProviderRepositoryLogger = new Logger <GenericRepository <TlProvider> >(new NullLoggerFactory());
            TlProviderRepository       = new GenericRepository <TlProvider>(TlProviderRepositoryLogger, DbContext);

            TlProviderAddressLogger     = new Logger <GenericRepository <TlProviderAddress> >(new NullLoggerFactory());
            TlProviderAddressRepository = new GenericRepository <TlProviderAddress>(TlProviderAddressLogger, DbContext);

            ProviderAddressServiceLogger = new Logger <ProviderAddressService>(new NullLoggerFactory());

            ProviderAddressService = new ProviderAddressService(TlProviderRepository, TlProviderAddressRepository, ProviderAddressMapper, ProviderAddressServiceLogger);
        }
 public PrintBatchItem Build(Batch batch = null, TlProviderAddress tlProviderAddress = null)
 {
     return(new PrintBatchItem
     {
         Batch = batch ?? new BatchBuilder().Build(),
         TlProviderAddress = tlProviderAddress ?? new TlProviderAddressBuilder().Build(),
         CreatedBy = Constants.CreatedByUser,
         CreatedOn = Constants.CreatedOn,
         ModifiedBy = Constants.ModifiedByUser,
         ModifiedOn = Constants.ModifiedOn
     });
 }
        public static TlProviderAddress CreateTlProviderAddress(ResultsAndCertificationDbContext _dbContext, int tlProviderId, string departmentName, string organisationName, string addressLine1, string addressLine2, string town, string postcode, bool addToDbContext = true)
        {
            var tlProviderAddress = new TlProviderAddress
            {
                TlProviderId     = tlProviderId,
                DepartmentName   = departmentName,
                OrganisationName = organisationName,
                AddressLine1     = addressLine1,
                AddressLine2     = addressLine2,
                Town             = town,
                Postcode         = postcode
            };

            if (addToDbContext)
            {
                _dbContext.Add(tlProviderAddress);
            }
            return(tlProviderAddress);
        }
        public static TlProviderAddress CreateTlProviderAddress(ResultsAndCertificationDbContext _dbContext, TlProviderAddress tlProviderAddress, bool addToDbContext = true)
        {
            if (tlProviderAddress == null)
            {
                tlProviderAddress = new TlProviderAddressBuilder().Build();
            }

            if (addToDbContext)
            {
                _dbContext.Add(tlProviderAddress);
            }
            return(tlProviderAddress);
        }