예제 #1
0
 public IntegrationTest()
 {
     context                  = GetDbHelper.GetDbContext();
     PolicyRepository         = new PolicyRepository(context);
     CustomerRepository       = new CustomerRepository(context);
     CustomerPolicyRepository = new CustomerPolicyRepository(context);
 }
예제 #2
0
        public void GetCustomersPolicy()
        {
            CpeDbContext             context = GetDbHelper.GetDbContext();
            CustomerPolicyRepository CustomerPolicyRepository = new CustomerPolicyRepository(context);
            var list = CustomerPolicyRepository.GetAll();

            Assert.IsNotNull(list);
        }
예제 #3
0
        public static CpeDbContext GetDbContext()
        {
            var optionsBuilder = new DbContextOptionsBuilder <CpeDbContext>();

            optionsBuilder.UseSqlServer(DbConnectionString);

            var context = new CpeDbContext(optionsBuilder.Options);

            return(context);
        }
예제 #4
0
        public void AddExistingValue()
        {
            CpeDbContext             context = GetDbHelper.GetDbContext();
            CustomerPolicyRepository CustomerPolicyRepository = new CustomerPolicyRepository(context);
            CustomerPolicyModel      customerPolicy           = new CustomerPolicyModel()
            {
                CustomerId = 1,
                PolicyId   = 1
            };

            CustomerPolicyRepository.Add(customerPolicy);
            Assert.Fail();
        }
예제 #5
0
 public PolicyRepository(CpeDbContext context)
 {
     _context = context;
 }
 public CustomerPolicyRepository(CpeDbContext context)
 {
     _context = context;
 }
예제 #7
0
 public PolicyUnitTest1()
 {
     context          = GetDbHelper.GetDbContext();
     PolicyRepository = new PolicyRepository(context);
 }