Exemple #1
0
        public void GetNumberOfWarrantyOrderByInvoiceIdAndProductId_Success_ReturnInt()
        {
            // Arrange
            var repository = new WarrantyOrderRepository();

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

            // Assert
            Assert.That(result >= 0);
        }
Exemple #2
0
        public void Get_Fail_ReturnNull()
        {
            // Arrange
            var repository = new WarrantyOrderRepository();

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

            // Assert
            Assert.IsNull(result);
        }
Exemple #3
0
        public void Create_Success_ReturnEntity()
        {
            // Arrange
            var repository = new WarrantyOrderRepository();
            var input      = GenerateInput();

            // Act
            var result = repository.Create(input);

            // Assert
            Assert.That(CompareProperties(input, result));
        }
Exemple #4
0
        public void Get_Success_ReturnEntity()
        {
            // Arrange
            var repository = new WarrantyOrderRepository();
            var input      = repository.Create(GenerateInput());

            // Act
            var result = repository.Get(input.Id);

            // Assert
            Assert.IsInstanceOf <WarrantyOrder>(result);
        }
Exemple #5
0
        public void Update_Success_ReturnFalse()
        {
            // Arrange
            var repository = new WarrantyOrderRepository();
            var input      = GenerateInput(generateId: true);

            // Act
            var result = repository.Update(input);

            // Assert
            Assert.IsFalse(result);
        }
Exemple #6
0
        public void Delete_Success_ReturnNull()
        {
            // Arrange
            var repository = new WarrantyOrderRepository();
            var input      = repository.Create(GenerateInput());

            // Act
            repository.Delete(input.Id);
            var result = repository.Get(input.Id);

            // Assert
            Assert.IsNull(result);
        }
Exemple #7
0
        public void Update_Success_ReturnTrue()
        {
            // Arrange
            var repository = new WarrantyOrderRepository();
            var input      = repository.Create(GenerateInput());

            var inputForUpdate = GenerateInput(id: input.Id);

            // Act
            var result = repository.Update(inputForUpdate);

            // Assert
            Assert.IsTrue(result);
        }
Exemple #8
0
        public void GetAllWithStatusFilter_Success_ReturnEntities()
        {
            // Arrange
            var repository = new WarrantyOrderRepository();
            var filter     = new List <WarrantyOrderStatus>()
            {
                WarrantyOrderStatus.WaitForSent,
                WarrantyOrderStatus.Sent,
                WarrantyOrderStatus.WaitForCustomer,
                WarrantyOrderStatus.Done,
            };
            // Act
            var result = repository.GetAllWithStatusFilter(filter);

            // Assert
            Assert.IsInstanceOf <IEnumerable <WarrantyOrder> >(result);
        }
 public WarrantyService()
 {
     _invoiceProductRepository = new InvoiceProductRepository();
     _warrantyOrderRepository  = new WarrantyOrderRepository();
 }