public InvoiceService() { _invoiceRepository = new InvoiceRepository(); _customerRepository = new CustomerRepository(); _invoiceProductRepository = new InvoiceProductRepository(); _productRepository = new ProductRepository(); _customerLevelRepository = new CustomerLevelRepository(); }
public void Get_Fail_ReturnNull() { // Arrange var repository = new InvoiceProductRepository(); // Act var result = repository.Get(111_111_111); // Assert Assert.IsNull(result); }
public void GetNumberOfProductByInvoiceId_Success_ReturnInt() { // Arrange var repository = new InvoiceProductRepository(); // Act var result = repository.GetNumberOfProductByInvoiceId(1, 1); // Assert Assert.That(result >= 0); }
public void Create_Success_ReturnEntity() { // Arrange var repository = new InvoiceProductRepository(); var input = GenerateInput(); // Act var result = repository.Create(input); // Assert Assert.That(CompareProperties(input, result)); }
public void Get_Success_ReturnEntity() { // Arrange var repository = new InvoiceProductRepository(); var input = repository.Create(GenerateInput()); // Act var result = repository.Get(input.Id); // Assert Assert.IsInstanceOf <InvoiceProduct>(result); }
public void GetInvoiceProductsByCustomerPhoneNumber_Success_ReturnEntities() { // Arrange var repository = new InvoiceProductRepository(); var phoneNumber = Helper.RandomNumber(10); // Act var result = repository.GetInvoiceProductsByCustomerPhoneNumber(phoneNumber); // Assert Assert.IsInstanceOf <IEnumerable <InvoiceProduct> >(result); }
public void Update_Success_ReturnFalse() { // Arrange var repository = new InvoiceProductRepository(); var input = GenerateInput(generateId: true); // Act var result = repository.Update(input); // Assert Assert.IsFalse(result); }
public void Delete_Success_ReturnNull() { // Arrange var repository = new InvoiceProductRepository(); var input = repository.Create(GenerateInput()); // Act repository.Delete(input.Id); var result = repository.Get(input.Id); // Assert Assert.IsNull(result); }
public void Update_Success_ReturnTrue() { // Arrange var repository = new InvoiceProductRepository(); var input = repository.Create(GenerateInput()); var inputForUpdate = GenerateInput(id: input.Id); // Act var result = repository.Update(inputForUpdate); // Assert Assert.IsTrue(result); }
public WarrantyService() { _invoiceProductRepository = new InvoiceProductRepository(); _warrantyOrderRepository = new WarrantyOrderRepository(); }