|
1 |
| -using System.Globalization; |
2 | 1 | using FluentAssertions;
|
3 | 2 | using JsonApiDotNetCore.Configuration;
|
4 | 3 | using JsonApiDotNetCore.OpenApi.Client.NSwag;
|
@@ -352,7 +351,7 @@ public async Task Cannot_use_double_outside_of_valid_range(double age)
|
352 | 351 |
|
353 | 352 | ErrorObject errorObject = document.Errors.First();
|
354 | 353 | errorObject.Title.Should().Be("Input validation failed.");
|
355 |
| - errorObject.Detail.Should().Be("The field Age must be between 0.1 exclusive and 122.9 exclusive."); |
| 354 | + errorObject.Detail.Should().Be("The field Age must be between 0.1 and 122.9."); |
356 | 355 | errorObject.Source.ShouldNotBeNull();
|
357 | 356 | errorObject.Source.Pointer.Should().Be("/data/attributes/age");
|
358 | 357 | }
|
@@ -534,79 +533,6 @@ public async Task Cannot_use_TimeSpan_outside_of_valid_range()
|
534 | 533 | errorObject.Source.Pointer.Should().Be("/data/attributes/nextRevalidation");
|
535 | 534 | }
|
536 | 535 |
|
537 |
| - [Fact] |
538 |
| - public async Task Cannot_use_culture_sensitive_TimeSpan() |
539 |
| - { |
540 |
| - // Arrange |
541 |
| - SocialMediaAccount newAccount = _fakers.SocialMediaAccount.Generate(); |
542 |
| - |
543 |
| - using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); |
544 |
| - ModelStateValidationClient apiClient = new(httpClient); |
545 |
| - |
546 |
| - SocialMediaAccountPostRequestDocument requestBody = new() |
547 |
| - { |
548 |
| - Data = new SocialMediaAccountDataInPostRequest |
549 |
| - { |
550 |
| - Attributes = new SocialMediaAccountAttributesInPostRequest |
551 |
| - { |
552 |
| - LastName = newAccount.LastName, |
553 |
| - NextRevalidation = new TimeSpan(0, 2, 0, 0, 1).ToString("g", new CultureInfo("fr-FR")) |
554 |
| - } |
555 |
| - } |
556 |
| - }; |
557 |
| - |
558 |
| - // Act |
559 |
| - Func<Task> action = () => apiClient.PostSocialMediaAccountAsync(requestBody); |
560 |
| - |
561 |
| - // Assert |
562 |
| - ErrorResponseDocument document = (await action.Should().ThrowExactlyAsync<ApiException<ErrorResponseDocument>>()).Which.Result; |
563 |
| - document.Errors.ShouldHaveCount(1); |
564 |
| - |
565 |
| - ErrorObject errorObject = document.Errors.First(); |
566 |
| - errorObject.Title.Should().Be("Failed to deserialize request body: Incompatible attribute value found."); |
567 |
| - |
568 |
| - errorObject.Detail.Should() |
569 |
| - .Be("Failed to convert attribute 'nextRevalidation' with value '2:00:00,001' of type 'String' to type 'Nullable<TimeSpan>'."); |
570 |
| - |
571 |
| - errorObject.Source.ShouldNotBeNull(); |
572 |
| - errorObject.Source.Pointer.Should().Be("/data/attributes/nextRevalidation"); |
573 |
| - } |
574 |
| - |
575 |
| - [Fact] |
576 |
| - public async Task Cannot_use_invalid_TimeOnly() |
577 |
| - { |
578 |
| - // Arrange |
579 |
| - SocialMediaAccount newAccount = _fakers.SocialMediaAccount.Generate(); |
580 |
| - |
581 |
| - using HttpClient httpClient = _testContext.Factory.CreateDefaultClient(_logHttpMessageHandler); |
582 |
| - ModelStateValidationClient apiClient = new(httpClient); |
583 |
| - |
584 |
| - SocialMediaAccountPostRequestDocument requestBody = new() |
585 |
| - { |
586 |
| - Data = new SocialMediaAccountDataInPostRequest |
587 |
| - { |
588 |
| - Attributes = new SocialMediaAccountAttributesInPostRequest |
589 |
| - { |
590 |
| - LastName = newAccount.LastName, |
591 |
| - ValidatedAtTime = TimeSpan.FromSeconds(-1) |
592 |
| - } |
593 |
| - } |
594 |
| - }; |
595 |
| - |
596 |
| - // Act |
597 |
| - Func<Task> action = () => apiClient.PostSocialMediaAccountAsync(requestBody); |
598 |
| - |
599 |
| - // Assert |
600 |
| - ErrorResponseDocument document = (await action.Should().ThrowExactlyAsync<ApiException<ErrorResponseDocument>>()).Which.Result; |
601 |
| - document.Errors.ShouldHaveCount(1); |
602 |
| - |
603 |
| - ErrorObject errorObject = document.Errors.First(); |
604 |
| - errorObject.Title.Should().Be("Failed to deserialize request body: Incompatible attribute value found."); |
605 |
| - errorObject.Detail.Should().Be("Failed to convert attribute 'validatedAtTime' with value '-00:00:01' of type 'String' to type 'Nullable<TimeOnly>'."); |
606 |
| - errorObject.Source.ShouldNotBeNull(); |
607 |
| - errorObject.Source.Pointer.Should().Be("/data/attributes/validatedAtTime"); |
608 |
| - } |
609 |
| - |
610 | 536 | [Fact]
|
611 | 537 | public async Task Can_create_resource_with_valid_properties()
|
612 | 538 | {
|
|
0 commit comments