public void Success_When_Creating_Customer() { var options = new DbContextOptionsBuilder <HaripayDataContext>() .UseInMemoryDatabase(databaseName: "Haripay") .Options; var context = new HaripayDataContext(options); var customerService = new CustomerService(context); Assert.IsType <Customer>(customerService.CreateCustomer("Test", 1)); }
public void Customer_Fullname_Is_Null_When_Creating() { var options = new DbContextOptionsBuilder <HaripayDataContext>() .UseInMemoryDatabase(databaseName: "Haripay") .Options; var context = new HaripayDataContext(options); var customerService = new CustomerService(context); Assert.Throws <ArgumentException>(() => customerService.CreateCustomer(String.Empty, 0)); }
public void Invalid_CustomerType_Is_Passed_When_Creating() { var options = new DbContextOptionsBuilder <HaripayDataContext>() .UseInMemoryDatabase(databaseName: "Haripay") .Options; var context = new HaripayDataContext(options); var customerService = new CustomerService(context); Assert.Throws <InvalidCastException>(() => customerService.CreateCustomer("Test", 20)); }
public void Success_When_Creating() { var options = new DbContextOptionsBuilder <HaripayDataContext>() .UseInMemoryDatabase(databaseName: "Haripay") .Options; var context = new HaripayDataContext(options); var discountService = new DiscountService(context); Assert.IsType <Discount>(discountService.CreateDiscount("Type 1", 20, 1, 1)); }
public void Returns_List_Of_Discounts() { var options = new DbContextOptionsBuilder <HaripayDataContext>() .UseInMemoryDatabase(databaseName: "Haripay") .Options; var context = new HaripayDataContext(options); var discountService = new DiscountService(context); Assert.IsType <List <Discount> >(discountService.GetAllDiscounts()); }
public void Invalid_Variable_Configured_When_Creating() { var options = new DbContextOptionsBuilder <HaripayDataContext>() .UseInMemoryDatabase(databaseName: "Haripay") .Options; var context = new HaripayDataContext(options); var discountService = new DiscountService(context); Assert.Throws <ArgumentException>(() => discountService.CreateDiscount("Type 1", 20, 2, 1)); }
public void Discount_Status_Is_Invalid_When_Creating() { var options = new DbContextOptionsBuilder <HaripayDataContext>() .UseInMemoryDatabase(databaseName: "Haripay") .Options; var context = new HaripayDataContext(options); var discountService = new DiscountService(context); Assert.Throws <InvalidCastException>(() => discountService.CreateDiscount("Type 1", 20, 1, 10)); }
public void Type_Is_Null_When_Creating() { var options = new DbContextOptionsBuilder <HaripayDataContext>() .UseInMemoryDatabase(databaseName: "Haripay") .Options; var context = new HaripayDataContext(options); var discountService = new DiscountService(context); Assert.Throws <ArgumentException>(() => discountService.CreateDiscount(String.Empty, 20, 1, 1)); }
public void Returns_Customer_By_Name() { var options = new DbContextOptionsBuilder <HaripayDataContext>() .UseInMemoryDatabase(databaseName: "Haripay") .Options; var context = new HaripayDataContext(options); var customerService = new CustomerService(context); customerService.CreateCustomer("Test 1", 1); customerService.CreateCustomer("Test 2", 2); Assert.IsType <Customer>(customerService.GetCustomerByName("Test 2")); }
public void Get_Discount_By_Type() { var options = new DbContextOptionsBuilder <HaripayDataContext>() .UseInMemoryDatabase(databaseName: "Haripay") .Options; var context = new HaripayDataContext(options); var discountService = new DiscountService(context); discountService.CreateDiscount("Type 1", 20, 1, 1); discountService.CreateDiscount("Type 2", 20, 1, 1); Assert.IsType <Discount>(discountService.GetDiscountByType("Type 1")); }
public void GetTotalInvoiceAmount_Discount_Not_Exists() { var options = new DbContextOptionsBuilder <HaripayDataContext>() .UseInMemoryDatabase(databaseName: "Haripay") .Options; var context = new HaripayDataContext(options); var discountService = new DiscountService(context); var customerService = new CustomerService(context); customerService.CreateCustomer("Test 1", 1); customerService.CreateCustomer("Test 2", 2); Assert.Throws <InvalidOperationException>(() => discountService.GetTotalInvoiceAmount(10, 200, false, 10)); }
public EmployeeService(HaripayDataContext context) { _context = context; }
public DiscountService(HaripayDataContext context) { _context = context; }
public CustomerService(HaripayDataContext context) { _context = context; }
public DepartmentService(HaripayDataContext context) { _context = context; }