Skip to content

Challenge

Challenge #17

GitHub Actions / Unit Tests succeeded Dec 15, 2024 in 0s

104 passed, 0 failed and 0 skipped

Tests passed successfully

✅ InventoryVenturus.Tests/TestResults/test_results.trx

104 tests were completed in 3s with 104 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
InventoryVenturus.Tests.Behaviors.ExceptionLoggingBehaviorTests 2✅ 147ms
InventoryVenturus.Tests.Behaviors.ValidationBehaviorTests 2✅ 19ms
InventoryVenturus.Tests.Controllers.ProductsControllerTests 10✅ 25ms
InventoryVenturus.Tests.Controllers.StockControllerTests 5✅ 18ms
InventoryVenturus.Tests.Controllers.TransactionsControllerTests 3✅ 83ms
InventoryVenturus.Tests.Exceptions.GlobalExceptionHandlerTests 3✅ 346ms
InventoryVenturus.Tests.Features.Products.Commands.Create.CreateProductCommandHandlerTests 3✅ 48ms
InventoryVenturus.Tests.Features.Products.Commands.Create.CreateProductCommandValidatorTests 5✅ 102ms
InventoryVenturus.Tests.Features.Products.Commands.Delete.DeleteProductCommandHandlerTests 3✅ 12ms
InventoryVenturus.Tests.Features.Products.Commands.Delete.DeleteProductCommandValidatorTests 2✅ 2ms
InventoryVenturus.Tests.Features.Products.Commands.Update.UpdateProductCommandHandlerTests 2✅ 10ms
InventoryVenturus.Tests.Features.Products.Commands.Update.UpdateProductCommandValidatorTests 6✅ 8ms
InventoryVenturus.Tests.Features.Products.Notifications.AssignProductStockHandlerTests 2✅ 6ms
InventoryVenturus.Tests.Features.Products.Notifications.DeleteProductStockHandlerTests 3✅ 23ms
InventoryVenturus.Tests.Features.Products.Notifications.DeleteProductTransactionsHandlerTests 3✅ 11ms
InventoryVenturus.Tests.Features.Products.Notifications.ProductCreatedNotificationValidatorTests 2✅ 6ms
InventoryVenturus.Tests.Features.Products.Notifications.ProductDeletionRequestedNotificationValidatorTests 2✅ 82ms
InventoryVenturus.Tests.Features.Products.Queries.Get.GetProductQueryHandlerTests 2✅ 5ms
InventoryVenturus.Tests.Features.Products.Queries.Get.GetProductQueryValidatorTests 2✅ 3ms
InventoryVenturus.Tests.Features.Products.Queries.List.ListProductsQueryHandlerTests 2✅ 173ms
InventoryVenturus.Tests.Features.Stock.Commands.Add.AddStockCommandHandlerTests 3✅ 16ms
InventoryVenturus.Tests.Features.Stock.Commands.Add.AddStockCommandValidatorTests 4✅ 10ms
InventoryVenturus.Tests.Features.Stock.Commands.Consume.ConsumeStockCommandHandlerTests 5✅ 225ms
InventoryVenturus.Tests.Features.Stock.Commands.Consume.ConsumeStockCommandValidatorTests 4✅ 8ms
InventoryVenturus.Tests.Features.Stock.Notifications.AddTransactionHandlerTests 2✅ 23ms
InventoryVenturus.Tests.Features.Stock.Notifications.ConsumeTransactionHandlerTests 2✅ 12ms
InventoryVenturus.Tests.Features.Stock.Notifications.StockAddedNotificationValidatorTests 5✅ 5ms
InventoryVenturus.Tests.Features.Stock.Notifications.StockConsumedNotificationValidatorTests 4✅ 68ms
InventoryVenturus.Tests.Features.Stock.Notifications.UpdateProductAveragePriceHandlerTests 3✅ 25ms
InventoryVenturus.Tests.Features.Stock.Queries.Get.GetStockQueryHandlerTests 2✅ 17ms
InventoryVenturus.Tests.Features.Stock.Queries.Get.GetStockQueryValidatorTests 2✅ 4ms
InventoryVenturus.Tests.Features.Transactions.Queries.GetDailyConsumption.GetDailyConsumptionQueryHandlerTests 2✅ 19ms
InventoryVenturus.Tests.Features.Transactions.Queries.GetDailyConsumption.GetDailyConsumptionQueryValidatorTests 2✅ 46ms

✅ InventoryVenturus.Tests.Behaviors.ExceptionLoggingBehaviorTests

✅ Handle_ShouldLogException_WhenExceptionIsThrown
✅ Handle_ShouldReturnResponse_WhenNoExceptionIsThrown

✅ InventoryVenturus.Tests.Behaviors.ValidationBehaviorTests

✅ Handle_ShouldCallNext_WhenValidationSucceeds
✅ Handle_ShouldThrowValidationException_WhenValidationFails

✅ InventoryVenturus.Tests.Controllers.ProductsControllerTests

✅ CreateProduct_ReturnsCreatedAtActionResult
✅ DeleteProduct_ReturnsNoContent_WhenDeleteIsSuccessful
✅ DeleteProduct_ThrowsException_WhenDeleteFails
✅ GetProductById_ReturnsOkResult_WhenProductExists
✅ GetProductById_ThrowsException_WhenProductDoesNotExist
✅ ListProducts_ReturnsOkResult_WithEmptyList_WhenNoProductsExist
✅ ListProducts_ReturnsOkResult_WithListOfProducts
✅ UpdateProduct_ReturnsNoContent_WhenUpdateIsSuccessful
✅ UpdateProduct_ThrowsException_WhenIdMismatch
✅ UpdateProduct_ThrowsException_WhenUpdateFails

✅ InventoryVenturus.Tests.Controllers.StockControllerTests

✅ AddStock_ReturnsNoContent_WhenAddIsSuccessful
✅ ConsumeStock_ReturnsNoContent_WhenConsumeIsSuccessful
✅ ConsumeStock_ThrowsException_WhenConsumeFails
✅ GetStock_ReturnsOkResult_WhenStockExists
✅ GetStock_ThrowsException_WhenStockDoesNotExist

✅ InventoryVenturus.Tests.Controllers.TransactionsControllerTests

✅ GetDailyConsumption_ReturnsOkResult_WithDailyConsumption
✅ GetDailyConsumption_ReturnsOkResult_WithEmptyList
✅ GetDailyConsumption_UsesTodaysDate_WhenDateNotSpecified

✅ InventoryVenturus.Tests.Exceptions.GlobalExceptionHandlerTests

✅ TryHandleAsync_ShouldHandleBaseException
✅ TryHandleAsync_ShouldHandleGeneralException
✅ TryHandleAsync_ShouldHandleValidationException

✅ InventoryVenturus.Tests.Features.Products.Commands.Create.CreateProductCommandHandlerTests

✅ Handle_ShouldAddProductAndReturnProductId
✅ Handle_ShouldPublishProductCreatedNotification
✅ Handle_ShouldThrowException_WhenProductRepositoryFails

✅ InventoryVenturus.Tests.Features.Products.Commands.Create.CreateProductCommandValidatorTests

✅ Should_Have_Error_When_Name_Exceeds_MaxLength
✅ Should_Have_Error_When_Name_Is_Empty
✅ Should_Have_Error_When_Partnumber_Exceeds_MaxLength
✅ Should_Have_Error_When_Partnumber_Is_Empty
✅ Should_Not_Have_Error_When_Command_Is_Valid

✅ InventoryVenturus.Tests.Features.Products.Commands.Delete.DeleteProductCommandHandlerTests

✅ Handle_ShouldReturnFalse_WhenProductDeletionFails
✅ Handle_ShouldReturnTrue_WhenProductIsDeletedSuccessfully
✅ Handle_ShouldThrowException_WhenAnErrorOccurs

✅ InventoryVenturus.Tests.Features.Products.Commands.Delete.DeleteProductCommandValidatorTests

✅ Validate_ShouldReturnFalse_WhenProductIdIsInvalid
✅ Validate_ShouldReturnTrue_WhenCommandIsValid

✅ InventoryVenturus.Tests.Features.Products.Commands.Update.UpdateProductCommandHandlerTests

✅ Handle_ShouldReturnFalse_WhenUpdateFails
✅ Handle_ShouldReturnTrue_WhenUpdateIsSuccessful

✅ InventoryVenturus.Tests.Features.Products.Commands.Update.UpdateProductCommandValidatorTests

✅ Should_Have_Error_When_Id_Is_Empty
✅ Should_Have_Error_When_Name_Exceeds_MaxLength
✅ Should_Have_Error_When_Name_Is_Empty
✅ Should_Have_Error_When_Partnumber_Exceeds_MaxLength
✅ Should_Have_Error_When_Partnumber_Is_Empty
✅ Should_Not_Have_Error_When_Command_Is_Valid

✅ InventoryVenturus.Tests.Features.Products.Notifications.AssignProductStockHandlerTests

✅ Handle_ShouldCreateStockRecord_WhenProductCreatedNotificationIsReceived
✅ Handle_ShouldThrow_WhenExceptionIsThrown

✅ InventoryVenturus.Tests.Features.Products.Notifications.DeleteProductStockHandlerTests

✅ Handle_ShouldDeleteStockRecord_WhenProductDeletionRequestedNotificationIsReceived
✅ Handle_ShouldNotThrowException_WhenStockNotFound
✅ Handle_ShouldThrowException_WhenRepositoryThrowsException

✅ InventoryVenturus.Tests.Features.Products.Notifications.DeleteProductTransactionsHandlerTests

✅ Handle_ShouldDeleteTransactionRecord_WhenProductDeletionRequestedNotificationIsReceived
✅ Handle_ShouldNotThrowException_WhenTransactionsNotFound
✅ Handle_ShouldThrowException_WhenRepositoryThrowsException

✅ InventoryVenturus.Tests.Features.Products.Notifications.ProductCreatedNotificationValidatorTests

✅ Validate_ShouldReturnFalse_WhenProductIdIsInvalid
✅ Validate_ShouldReturnTrue_WhenNotificationIsValid

✅ InventoryVenturus.Tests.Features.Products.Notifications.ProductDeletionRequestedNotificationValidatorTests

✅ Validate_ShouldReturnFalse_WhenProductIdIsInvalid
✅ Validate_ShouldReturnTrue_WhenNotificationIsValid

✅ InventoryVenturus.Tests.Features.Products.Queries.Get.GetProductQueryHandlerTests

✅ Handle_ShouldReturnNull_WhenProductDoesNotExist
✅ Handle_ShouldReturnProductDto_WhenProductExists

✅ InventoryVenturus.Tests.Features.Products.Queries.Get.GetProductQueryValidatorTests

✅ Validate_ShouldReturnFalse_WhenProductIdIsInvalid
✅ Validate_ShouldReturnTrue_WhenQueryIsValid

✅ InventoryVenturus.Tests.Features.Products.Queries.List.ListProductsQueryHandlerTests

✅ Handle_ShouldReturnEmptyList_WhenNoProductsExist
✅ Handle_ShouldReturnListOfProductDtos_WhenProductsExist

✅ InventoryVenturus.Tests.Features.Stock.Commands.Add.AddStockCommandHandlerTests

✅ Handle_ShouldIncreaseStockAndReturnTrue
✅ Handle_ShouldReturnFalse_WhenUpdateStockFails
✅ Handle_ShouldThrowException_WhenStockRepositoryFails

✅ InventoryVenturus.Tests.Features.Stock.Commands.Add.AddStockCommandValidatorTests

✅ Validate_ShouldReturnFalse_WhenAddedPriceIsInvalid
✅ Validate_ShouldReturnFalse_WhenAddedQuantityIsInvalid
✅ Validate_ShouldReturnFalse_WhenProductIdIsInvalid
✅ Validate_ShouldReturnTrue_WhenCommandIsValid

✅ InventoryVenturus.Tests.Features.Stock.Commands.Consume.ConsumeStockCommandHandlerTests

✅ Handle_ShouldDecreaseStockAndReturnTrue
✅ Handle_ShouldReturnFalse_WhenStockOrProductNotFound
✅ Handle_ShouldReturnFalse_WhenUpdateStockFails
✅ Handle_ShouldThrowException_WhenInsufficientStock
✅ Handle_ShouldThrowException_WhenStockRepositoryFails

✅ InventoryVenturus.Tests.Features.Stock.Commands.Consume.ConsumeStockCommandValidatorTests

✅ Validate_ShouldReturnFalse_WhenConsumedQuantityIsInvalid
✅ Validate_ShouldReturnFalse_WhenConsumedQuantityIsZero
✅ Validate_ShouldReturnFalse_WhenProductIdIsInvalid
✅ Validate_ShouldReturnTrue_WhenCommandIsValid

✅ InventoryVenturus.Tests.Features.Stock.Notifications.AddTransactionHandlerTests

✅ Handle_ShouldAddTransaction_WhenStockAddedNotificationIsReceived
✅ Handle_ShouldLogError_WhenExceptionIsThrown

✅ InventoryVenturus.Tests.Features.Stock.Notifications.ConsumeTransactionHandlerTests

✅ Handle_ShouldAddTransaction_WhenStockConsumedNotificationIsReceived
✅ Handle_ShouldThrowException_WhenExceptionIsThrown

✅ InventoryVenturus.Tests.Features.Stock.Notifications.StockAddedNotificationValidatorTests

✅ Validate_ShouldReturnFalse_WhenAddedQuantityIsInvalid
✅ Validate_ShouldReturnFalse_WhenFinalQuantityIsInvalid
✅ Validate_ShouldReturnFalse_WhenProductIdIsInvalid
✅ Validate_ShouldReturnFalse_WhenUnitPriceIsInvalid
✅ Validate_ShouldReturnTrue_WhenNotificationIsValid

✅ InventoryVenturus.Tests.Features.Stock.Notifications.StockConsumedNotificationValidatorTests

✅ Validate_ShouldReturnFalse_WhenConsumedQuantityIsInvalid
✅ Validate_ShouldReturnFalse_WhenProductIdIsInvalid
✅ Validate_ShouldReturnFalse_WhenUnitCostIsInvalid
✅ Validate_ShouldReturnTrue_WhenNotificationIsValid

✅ InventoryVenturus.Tests.Features.Stock.Notifications.UpdateProductAveragePriceHandlerTests

✅ Handle_ShouldNotUpdateAveragePrice_WhenUpdateAveragePriceFails
✅ Handle_ShouldThrowException_WhenExceptionIsThrown
✅ Handle_ShouldUpdateAveragePrice_WhenStockAddedNotificationIsReceived

✅ InventoryVenturus.Tests.Features.Stock.Queries.Get.GetStockQueryHandlerTests

✅ Handle_ShouldReturnNull_WhenStockDoesNotExist
✅ Handle_ShouldReturnStockCount_WhenStockExists

✅ InventoryVenturus.Tests.Features.Stock.Queries.Get.GetStockQueryValidatorTests

✅ Validate_ShouldReturnFalse_WhenProductIdIsInvalid
✅ Validate_ShouldReturnTrue_WhenQueryIsValid

✅ InventoryVenturus.Tests.Features.Transactions.Queries.GetDailyConsumption.GetDailyConsumptionQueryHandlerTests

✅ Handle_ShouldReturnEmptyList_WhenNoTransactionsExist
✅ Handle_ShouldReturnGroupedDailyConsumption_WhenTransactionsExist

✅ InventoryVenturus.Tests.Features.Transactions.Queries.GetDailyConsumption.GetDailyConsumptionQueryValidatorTests

✅ Should_Have_Error_When_Date_Is_In_The_Future
✅ Should_Not_Have_Error_When_Date_Is_Today_Or_Past