示例#1
0
 public InvoiceService()
 {
     _invoiceRepository        = new InvoiceRepository();
     _customerRepository       = new CustomerRepository();
     _invoiceProductRepository = new InvoiceProductRepository();
     _productRepository        = new ProductRepository();
     _customerLevelRepository  = new CustomerLevelRepository();
 }
示例#2
0
        public void Get_Fail_ReturnNull()
        {
            // Arrange
            var repository = new InvoiceProductRepository();

            // Act
            var result = repository.Get(111_111_111);

            // Assert
            Assert.IsNull(result);
        }
示例#3
0
        public void GetNumberOfProductByInvoiceId_Success_ReturnInt()
        {
            // Arrange
            var repository = new InvoiceProductRepository();

            // Act
            var result = repository.GetNumberOfProductByInvoiceId(1, 1);

            // Assert
            Assert.That(result >= 0);
        }
示例#4
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));
        }
示例#5
0
        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);
        }
示例#6
0
        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);
        }
示例#7
0
        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);
        }
示例#8
0
        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);
        }
示例#9
0
        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);
        }
示例#10
0
 public WarrantyService()
 {
     _invoiceProductRepository = new InvoiceProductRepository();
     _warrantyOrderRepository  = new WarrantyOrderRepository();
 }