Пример #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();
 }