приблизний список модульних та інтеграційних тестів для курсового проєкту
Unit-тести
OmdbServiceTests
SearchAsync_WithValidQuery_ReturnsSearchResponseSearchAsync_WithEmptyQuery_ThrowsArgumentExceptionSearchAsync_WithWhitespaceQuery_ThrowsArgumentExceptionSearchAsync_ClampsPageBelowOneSearchAsync_ClampsPageAboveOneHundredSearchAsync_TrimsQuerySearchAsync_SendsApiKeySearchAsync_SendsSearchQuerySearchAsync_SendsPageSearchAsync_EncodesQueryParametersSearchAsync_WhenOmdbReturnsValidResponse_DeserializesResponseSearchAsync_WhenOmdbReturnsFalseResponse_ReturnsErrorDtoSearchAsync_WhenOmdbReturnsEmptyResponse_ReturnsErrorDtoSearchAsync_WhenHttpRequestFails_ThrowsHttpRequestExceptionSearchAsync_PassesCancellationTokenGetByImdbIdAsync_WithValidId_ReturnsFilmDtoGetByImdbIdAsync_WithEmptyId_ThrowsArgumentExceptionGetByImdbIdAsync_WithWhitespaceId_ThrowsArgumentExceptionGetByImdbIdAsync_TrimsImdbIdGetByImdbIdAsync_SendsApiKeyGetByImdbIdAsync_SendsImdbIdGetByImdbIdAsync_SendsFullPlotParameterGetByImdbIdAsync_EncodesQueryParametersGetByImdbIdAsync_WhenOmdbReturnsValidResponse_DeserializesFilmGetByImdbIdAsync_WhenOmdbReturnsFalseResponse_ReturnsErrorDtoGetByImdbIdAsync_WhenOmdbReturnsEmptyResponse_ReturnsErrorDtoGetByImdbIdAsync_WhenHttpRequestFails_ThrowsHttpRequestExceptionGetByImdbIdAsync_PassesCancellationToken
AddressServiceTests
GetAllAsync_ReturnsAllAddressesGetByIdAsync_WithExistingId_ReturnsAddressGetByIdAsync_WithNonExistingId_ReturnsNullCreateAsync_WithValidAddress_CreatesAddressCreateAsync_WithInvalidAddress_ThrowsValidationExceptionUpdateAsync_WithExistingAddress_UpdatesAddressUpdateAsync_WithNonExistingAddress_ThrowsKeyNotFoundExceptionDeleteAsync_WithExistingAddress_DeletesAddressDeleteAsync_WithNonExistingAddress_ThrowsKeyNotFoundExceptionGetByUserIdAsync_WithExistingUser_ReturnsAddressesGetByUserIdAsync_WithNoAddresses_ReturnsEmptyCollection
CartItemServiceTests
GetAllAsync_ReturnsAllCartItemsGetByIdAsync_WithExistingId_ReturnsCartItemGetByIdAsync_WithNonExistingId_ReturnsNullGetByCartIdAsync_ReturnsCartItemsForCartCreateAsync_WithValidCartItem_CreatesCartItemCreateAsync_WithInvalidProduct_ThrowsKeyNotFoundExceptionCreateAsync_WithInvalidCart_ThrowsKeyNotFoundExceptionCreateAsync_WithNegativeQuantity_ThrowsValidationExceptionUpdateAsync_WithExistingCartItem_UpdatesCartItemUpdateAsync_WithNonExistingCartItem_ThrowsKeyNotFoundExceptionDeleteAsync_WithExistingCartItem_DeletesCartItemDeleteAsync_WithNonExistingCartItem_ThrowsKeyNotFoundExceptionCalculateSubtotal_ReturnsCorrectValue
CartServiceTests
GetAllAsync_ReturnsAllCartsGetByIdAsync_WithExistingId_ReturnsCartGetByIdAsync_WithNonExistingId_ReturnsNullGetByUserIdAsync_WithExistingUser_ReturnsCartGetByUserIdAsync_WhenCartDoesNotExist_ReturnsNullCreateAsync_WithValidCart_CreatesCartCreateAsync_WithInvalidUser_ThrowsKeyNotFoundExceptionUpdateAsync_WithExistingCart_UpdatesCartUpdateAsync_WithNonExistingCart_ThrowsKeyNotFoundExceptionDeleteAsync_WithExistingCart_DeletesCartDeleteAsync_WithNonExistingCart_ThrowsKeyNotFoundExceptionCalculateTotal_WithCartItems_ReturnsCorrectTotalCalculateTotal_WithEmptyCart_ReturnsZeroAddItemAsync_AddsItemToCartAddItemAsync_WithExistingProduct_UpdatesQuantityRemoveItemAsync_RemovesItemFromCartClearAsync_RemovesAllCartItems
CategoryServiceTests
GetAllAsync_ReturnsAllCategoriesGetByIdAsync_WithExistingId_ReturnsCategoryGetByIdAsync_WithNonExistingId_ReturnsNullCreateAsync_WithValidCategory_CreatesCategoryCreateAsync_WithDuplicateName_ThrowsValidationExceptionCreateAsync_WithInvalidCategory_ThrowsValidationExceptionUpdateAsync_WithExistingCategory_UpdatesCategoryUpdateAsync_WithNonExistingCategory_ThrowsKeyNotFoundExceptionUpdateAsync_WithDuplicateName_ThrowsValidationExceptionDeleteAsync_WithExistingCategory_DeletesCategoryDeleteAsync_WithNonExistingCategory_ThrowsKeyNotFoundExceptionDeleteAsync_WithProducts_ThrowsInvalidOperationException
OrderItemServiceTests
GetAllAsync_ReturnsAllOrderItemsGetByIdAsync_WithExistingId_ReturnsOrderItemGetByIdAsync_WithNonExistingId_ReturnsNullGetByOrderIdAsync_ReturnsOrderItemsForOrderCreateAsync_WithValidOrderItem_CreatesOrderItemCreateAsync_WithInvalidOrder_ThrowsKeyNotFoundExceptionCreateAsync_WithInvalidProduct_ThrowsKeyNotFoundExceptionCreateAsync_WithInvalidQuantity_ThrowsValidationExceptionUpdateAsync_WithExistingOrderItem_UpdatesOrderItemUpdateAsync_WithNonExistingOrderItem_ThrowsKeyNotFoundExceptionDeleteAsync_WithExistingOrderItem_DeletesOrderItemDeleteAsync_WithNonExistingOrderItem_ThrowsKeyNotFoundExceptionCalculateSubtotal_ReturnsCorrectValue
OrderServiceTests
GetAllAsync_ReturnsAllOrdersGetByIdAsync_WithExistingId_ReturnsOrderGetByIdAsync_WithNonExistingId_ReturnsNullGetByUserIdAsync_ReturnsUserOrdersCreateAsync_WithValidOrder_CreatesOrderCreateAsync_WithInvalidUser_ThrowsKeyNotFoundExceptionCreateAsync_WithEmptyItems_ThrowsValidationExceptionCreateAsync_CalculatesTotalCorrectlyCreateAsync_CreatesOrderItemsUpdateAsync_WithExistingOrder_UpdatesOrderUpdateAsync_WithNonExistingOrder_ThrowsKeyNotFoundExceptionUpdateAsync_UpdatesOrderStatusDeleteAsync_WithExistingOrder_DeletesOrderDeleteAsync_WithNonExistingOrder_ThrowsKeyNotFoundExceptionCalculateTotal_ReturnsCorrectTotalCalculateTotal_WithEmptyOrder_ReturnsZero
ProductServiceTests
GetAllAsync_ReturnsAllProductsGetByIdAsync_WithExistingId_ReturnsProductGetByIdAsync_WithNonExistingId_ReturnsNullGetByCategoryIdAsync_ReturnsProductsForCategorySearchAsync_WithMatchingName_ReturnsProductsSearchAsync_WithNoMatches_ReturnsEmptyCollectionCreateAsync_WithValidProduct_CreatesProductCreateAsync_WithInvalidCategory_ThrowsKeyNotFoundExceptionCreateAsync_WithInvalidPrice_ThrowsValidationExceptionCreateAsync_WithNegativeStock_ThrowsValidationExceptionUpdateAsync_WithExistingProduct_UpdatesProductUpdateAsync_WithNonExistingProduct_ThrowsKeyNotFoundExceptionUpdateAsync_WithInvalidCategory_ThrowsKeyNotFoundExceptionUpdateAsync_WithInvalidPrice_ThrowsValidationExceptionDeleteAsync_WithExistingProduct_DeletesProductDeleteAsync_WithNonExistingProduct_ThrowsKeyNotFoundExceptionUpdateStock_WithValidQuantity_UpdatesStockUpdateStock_WithNegativeQuantity_ThrowsValidationExceptionDecreaseStock_WhenEnoughStock_DecreasesStockDecreaseStock_WhenInsufficientStock_ThrowsInvalidOperationException
LoginValidatorTests
Validate_WithValidLogin_SucceedsValidate_WithEmptyEmail_FailsValidate_WithInvalidEmail_FailsValidate_WithEmptyPassword_FailsValidate_WithShortPassword_Fails
RegisterValidatorTests
Validate_WithValidRegistration_SucceedsValidate_WithEmptyEmail_FailsValidate_WithInvalidEmail_FailsValidate_WithEmptyPassword_FailsValidate_WithShortPassword_FailsValidate_WithMismatchedPasswords_FailsValidate_WithEmptyName_FailsValidate_WithInvalidName_Fails
CreateCartItemValidatorTests
Validate_WithValidCartItem_SucceedsValidate_WithInvalidCartId_FailsValidate_WithInvalidProductId_FailsValidate_WithZeroQuantity_FailsValidate_WithNegativeQuantity_Fails
CreateCategoryValidatorTests
Validate_WithValidCategory_SucceedsValidate_WithEmptyName_FailsValidate_WithTooLongName_Fails
CreateOrderValidatorTests
Validate_WithValidOrder_SucceedsValidate_WithInvalidUserId_FailsValidate_WithEmptyItems_FailsValidate_WithInvalidAddress_Fails
CreateProductValidatorTests
Validate_WithValidProduct_SucceedsValidate_WithEmptyName_FailsValidate_WithInvalidPrice_FailsValidate_WithNegativeStock_FailsValidate_WithInvalidCategoryId_Fails
UpdateCategoryValidatorTests
Validate_WithValidCategory_SucceedsValidate_WithEmptyName_FailsValidate_WithTooLongName_FailsValidate_WithInvalidId_Fails
UpdateProductValidatorTests
Validate_WithValidProduct_SucceedsValidate_WithEmptyName_FailsValidate_WithInvalidPrice_FailsValidate_WithNegativeStock_FailsValidate_WithInvalidCategoryId_FailsValidate_WithInvalidId_Fails
AddressMappingTests
ToDto_WithValidEntity_ReturnsCorrectDtoToEntity_WithValidDto_ReturnsCorrectEntityToDto_WithNullEntity_ReturnsNullToEntity_WithNullDto_ReturnsNull
CartItemMappingTests
ToDto_WithValidEntity_ReturnsCorrectDtoToEntity_WithValidDto_ReturnsCorrectEntityToDto_WithNullEntity_ReturnsNullToEntity_WithNullDto_ReturnsNull
CategoryMappingTests
ToDto_WithValidEntity_ReturnsCorrectDtoToEntity_WithValidDto_ReturnsCorrectEntityToDto_WithNullEntity_ReturnsNullToEntity_WithNullDto_ReturnsNull
OrderItemMappingTests
ToDto_WithValidEntity_ReturnsCorrectDtoToEntity_WithValidDto_ReturnsCorrectEntityToDto_WithNullEntity_ReturnsNullToEntity_WithNullDto_ReturnsNull
ProductMappingTests
ToDto_WithValidEntity_ReturnsCorrectDtoToEntity_WithValidDto_ReturnsCorrectEntityToDto_WithNullEntity_ReturnsNullToEntity_WithNullDto_ReturnsNull
FilmsControllerTests
Search_WithMissingQuery_ReturnsBadRequestSearch_WithEmptyQuery_ReturnsBadRequestSearch_WithWhitespaceQuery_ReturnsBadRequestSearch_WithValidQuery_ReturnsOkSearch_WithValidQuery_PassesQueryToServiceSearch_WithValidPage_PassesPageToServiceSearch_WithDefaultPage_PassesPageOneToServiceSearch_WhenServiceReturnsFalseResponse_ReturnsNotFoundSearch_WhenServiceReturnsFalseResponse_UsesServiceErrorSearch_WhenServiceReturnsFalseResponseWithoutError_UsesDefaultMessageSearch_WhenServiceThrowsHttpRequestException_ReturnsBadGatewaySearch_WhenServiceThrowsHttpRequestException_UsesExceptionMessageGetByImdbId_WithValidId_ReturnsOkGetByImdbId_PassesIdToServiceGetByImdbId_WhenServiceReturnsFalseResponse_ReturnsNotFoundGetByImdbId_WhenServiceReturnsFalseResponse_UsesServiceErrorGetByImdbId_WhenServiceThrowsHttpRequestException_ReturnsBadGatewayGetByImdbId_WhenServiceThrowsHttpRequestException_UsesExceptionMessage
WeatherForecastControllerTests
Get_ReturnsFiveForecastsGet_ReturnsForecastsForNextFiveDaysGet_ReturnsValidTemperatureRangeGet_ReturnsValidSummaryGet_ReturnsNonNullForecasts
Integration-тести
FilmsControllerIntegrationTests
Search_WithValidQuery_ReturnsOkSearch_WithMissingQuery_ReturnsBadRequestSearch_WithEmptyQuery_ReturnsBadRequestSearch_WithWhitespaceQuery_ReturnsBadRequestSearch_WithValidPage_ReturnsExpectedPageSearch_WithInvalidPage_ReturnsExpectedValidationResultSearch_WhenOmdbReturnsValidResponse_ReturnsExpectedDataSearch_WhenOmdbReturnsFalseResponse_ReturnsNotFoundSearch_WhenOmdbReturnsError_ReturnsExpectedErrorSearch_WhenOmdbUnavailable_ReturnsBadGatewaySearch_ReturnsExpectedJsonStructureSearch_ReturnsExpectedContentTypeGetByImdbId_WithValidId_ReturnsOkGetByImdbId_WithInvalidId_ReturnsNotFoundGetByImdbId_WithEmptyId_ReturnsBadRequestGetByImdbId_WhenOmdbReturnsValidResponse_ReturnsExpectedDataGetByImdbId_WhenOmdbReturnsFalseResponse_ReturnsNotFoundGetByImdbId_WhenOmdbUnavailable_ReturnsBadGatewayGetByImdbId_ReturnsExpectedJsonStructureGetByImdbId_ReturnsExpectedContentType
WeatherForecastControllerIntegrationTests
Get_ReturnsOkGet_ReturnsFiveForecastsGet_ReturnsExpectedJsonStructureGet_ReturnsExpectedContentTypeGet_ReturnsDatesForNextFiveDaysGet_ReturnsValidTemperatureRangeGet_ReturnsValidSummary
AddressIntegrationTests
GetAll_ReturnsOkGetAll_ReturnsAllAddressesGetById_WithExistingId_ReturnsOkGetById_WithNonExistingId_ReturnsNotFoundCreate_WithValidAddress_ReturnsCreatedCreate_WithInvalidAddress_ReturnsBadRequestUpdate_WithExistingAddress_ReturnsOkUpdate_WithNonExistingAddress_ReturnsNotFoundDelete_WithExistingAddress_ReturnsNoContentDelete_WithNonExistingAddress_ReturnsNotFoundGetByUserId_ReturnsUserAddresses
CartIntegrationTests
GetAll_ReturnsOkGetById_WithExistingId_ReturnsOkGetById_WithNonExistingId_ReturnsNotFoundGetByUserId_ReturnsUserCartCreate_WithValidCart_ReturnsCreatedCreate_WithInvalidCart_ReturnsBadRequestUpdate_WithExistingCart_ReturnsOkUpdate_WithNonExistingCart_ReturnsNotFoundDelete_WithExistingCart_ReturnsNoContentDelete_WithNonExistingCart_ReturnsNotFoundAddItem_WithValidData_ReturnsCreatedAddItem_WithInvalidProduct_ReturnsNotFoundAddItem_WithInvalidQuantity_ReturnsBadRequestRemoveItem_WithExistingItem_ReturnsNoContentClear_WithExistingCart_ReturnsNoContentGetById_ReturnsCalculatedTotal
CartItemIntegrationTests
GetAll_ReturnsOkGetById_WithExistingId_ReturnsOkGetById_WithNonExistingId_ReturnsNotFoundGetByCartId_ReturnsCartItemsCreate_WithValidCartItem_ReturnsCreatedCreate_WithInvalidCart_ReturnsNotFoundCreate_WithInvalidProduct_ReturnsNotFoundCreate_WithInvalidQuantity_ReturnsBadRequestUpdate_WithExistingCartItem_ReturnsOkUpdate_WithNonExistingCartItem_ReturnsNotFoundDelete_WithExistingCartItem_ReturnsNoContentDelete_WithNonExistingCartItem_ReturnsNotFound
CategoryIntegrationTests
GetAll_ReturnsOkGetAll_ReturnsAllCategoriesGetById_WithExistingId_ReturnsOkGetById_WithNonExistingId_ReturnsNotFoundCreate_WithValidCategory_ReturnsCreatedCreate_WithInvalidCategory_ReturnsBadRequestCreate_WithDuplicateName_ReturnsConflictUpdate_WithExistingCategory_ReturnsOkUpdate_WithNonExistingCategory_ReturnsNotFoundUpdate_WithDuplicateName_ReturnsConflictDelete_WithExistingCategory_ReturnsNoContentDelete_WithNonExistingCategory_ReturnsNotFoundDelete_WithProducts_ReturnsConflict
OrderIntegrationTests
GetAll_ReturnsOkGetAll_ReturnsOrdersGetById_WithExistingId_ReturnsOkGetById_WithNonExistingId_ReturnsNotFoundGetByUserId_ReturnsUserOrdersCreate_WithValidOrder_ReturnsCreatedCreate_WithInvalidUser_ReturnsNotFoundCreate_WithEmptyItems_ReturnsBadRequestCreate_CalculatesTotalCorrectlyCreate_CreatesOrderItemsUpdate_WithExistingOrder_ReturnsOkUpdate_WithNonExistingOrder_ReturnsNotFoundUpdate_ChangesOrderStatusDelete_WithExistingOrder_ReturnsNoContentDelete_WithNonExistingOrder_ReturnsNotFound
OrderItemIntegrationTests
GetAll_ReturnsOkGetById_WithExistingId_ReturnsOkGetById_WithNonExistingId_ReturnsNotFoundGetByOrderId_ReturnsOrderItemsCreate_WithValidOrderItem_ReturnsCreatedCreate_WithInvalidOrder_ReturnsNotFoundCreate_WithInvalidProduct_ReturnsNotFoundCreate_WithInvalidQuantity_ReturnsBadRequestUpdate_WithExistingOrderItem_ReturnsOkUpdate_WithNonExistingOrderItem_ReturnsNotFoundDelete_WithExistingOrderItem_ReturnsNoContentDelete_WithNonExistingOrderItem_ReturnsNotFound
ProductIntegrationTests
GetAll_ReturnsOkGetAll_ReturnsProductsGetById_WithExistingId_ReturnsOkGetById_WithNonExistingId_ReturnsNotFoundGetByCategoryId_ReturnsCategoryProductsSearch_WithMatchingName_ReturnsProductsSearch_WithNoMatches_ReturnsEmptyCollectionCreate_WithValidProduct_ReturnsCreatedCreate_WithInvalidProduct_ReturnsBadRequestCreate_WithInvalidCategory_ReturnsNotFoundUpdate_WithExistingProduct_ReturnsOkUpdate_WithNonExistingProduct_ReturnsNotFoundUpdate_WithInvalidCategory_ReturnsNotFoundDelete_WithExistingProduct_ReturnsNoContentDelete_WithNonExistingProduct_ReturnsNotFoundUpdateStock_WithValidQuantity_ReturnsOkUpdateStock_WithInvalidQuantity_ReturnsBadRequest
Integration-тести Infrastructure
AddressRepositoryIntegrationTests
GetAllAsync_ReturnsPersistedAddressesGetByIdAsync_ReturnsPersistedAddressGetByIdAsync_WhenAddressDoesNotExist_ReturnsNullAddAsync_PersistsAddressUpdateAsync_PersistsChangesDeleteAsync_RemovesAddressGetByUserIdAsync_ReturnsUserAddresses
CartRepositoryIntegrationTests
GetAllAsync_ReturnsPersistedCartsGetByIdAsync_ReturnsPersistedCartGetByUserIdAsync_ReturnsUserCartAddAsync_PersistsCartUpdateAsync_PersistsChangesDeleteAsync_RemovesCart
CartItemRepositoryIntegrationTests
GetAllAsync_ReturnsPersistedCartItemsGetByIdAsync_ReturnsPersistedCartItemGetByCartIdAsync_ReturnsCartItemsAddAsync_PersistsCartItemUpdateAsync_PersistsChangesDeleteAsync_RemovesCartItem
CategoryRepositoryIntegrationTests
GetAllAsync_ReturnsPersistedCategoriesGetByIdAsync_ReturnsPersistedCategoryAddAsync_PersistsCategoryUpdateAsync_PersistsChangesDeleteAsync_RemovesCategory
OrderRepositoryIntegrationTests
GetAllAsync_ReturnsPersistedOrdersGetByIdAsync_ReturnsPersistedOrderGetByUserIdAsync_ReturnsUserOrdersAddAsync_PersistsOrderUpdateAsync_PersistsChangesDeleteAsync_RemovesOrder
OrderItemRepositoryIntegrationTests
GetAllAsync_ReturnsPersistedOrderItemsGetByIdAsync_ReturnsPersistedOrderItemGetByOrderIdAsync_ReturnsOrderItemsAddAsync_PersistsOrderItemUpdateAsync_PersistsChangesDeleteAsync_RemovesOrderItem
ProductRepositoryIntegrationTests
GetAllAsync_ReturnsPersistedProductsGetByIdAsync_ReturnsPersistedProductGetByCategoryIdAsync_ReturnsCategoryProductsAddAsync_PersistsProductUpdateAsync_PersistsChangesDeleteAsync_RemovesProduct
Integration-тести DI та Application Startup
ApplicationStartupIntegrationTests
Application_StartsSuccessfullyApplication_RegistersControllersApplication_RegistersApplicationServicesApplication_RegistersInfrastructureServicesApplication_RegistersRepositoriesApplication_RegistersValidatorsApplication_RegistersMappingsApplication_RegistersOmdbServiceApplication_MapsControllersApplication_MapsFilmsEndpointsApplication_MapsWeatherForecastEndpointApplication_ResolvesAllRequiredDependencies
Integration-тести взаємодії шарів
ServiceRepositoryIntegrationTests
ProductService_CreateAsync_PersistsProductProductService_UpdateAsync_PersistsChangesProductService_DeleteAsync_RemovesProductCategoryService_CreateAsync_PersistsCategoryCategoryService_UpdateAsync_PersistsChangesCategoryService_DeleteAsync_RemovesCategoryCartService_CreateAsync_PersistsCartCartService_AddItemAsync_PersistsCartItemCartService_RemoveItemAsync_RemovesCartItemOrderService_CreateAsync_PersistsOrderOrderService_CreateAsync_PersistsOrderItemsOrderService_UpdateAsync_PersistsChangesOrderService_DeleteAsync_RemovesOrder