aspire icon indicating copy to clipboard operation
aspire copied to clipboard

add attribute default culture test/fixture

Open Zombach opened this issue 8 months ago • 5 comments

Description

issue proposed solution

Fixes # (issue)

Checklist

  • Is this feature complete?
    • [x] Yes. Ready to ship.
    • [ ] No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • [ ] Yes
    • [x] No
  • Did you add public API?
    • [ ] Yes
      • If yes, did you have an API Review for it?
        • [ ] Yes
        • [ ] No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • [ ] Yes
        • [ ] No
    • [x] No
  • Does the change make any security assumptions or guarantees?
    • [ ] Yes
      • If yes, have you done a threat model and had a security review?
        • [ ] Yes
        • [ ] No
    • [x] No
  • Does the change require an update in our Aspire docs?

Zombach avatar Apr 29 '25 18:04 Zombach

there is a sample for this actually https://github.com/xunit/samples.xunit/blob/main/v3/UseCultureExample/UseCultureAttribute.cs

what do you think of copying that instead @RussKie .. it allows you to pick a culture.

edit -- disregard -- brainstorm -- didn't read the whole PR haha.

danmoseley avatar Apr 29 '25 23:04 danmoseley

Oh nice, v3 now has the attribute!

RussKie avatar Apr 30 '25 00:04 RussKie

Test failure:

  failed Aspire.Hosting.Tests.ReferenceExpressionTests.ReferenceExpressionHandlesValueWithFormattingInParameterBrackets(input: "{0:D}", parameterValue: 2024-05-22T00:00:00.0000000, expected: "05/22/2024 00:00:00") (1ms)
    Assert.Equal() Failure: Strings differ
               ↓ (pos 0)
    Expected: "05/22/2024 00:00:00"
    Actual:   "5/22/2024 12:00:00 AM"
               ↑ (pos 0)

RussKie avatar Apr 30 '25 00:04 RussKie

Oh nice, v3 now has the attribute!

Unfortunately. It is only on the level of the example and it is not in the assembly.

Zombach avatar Apr 30 '25 08:04 Zombach

Test failure:

  failed Aspire.Hosting.Tests.ReferenceExpressionTests.ReferenceExpressionHandlesValueWithFormattingInParameterBrackets(input: "{0:D}", parameterValue: 2024-05-22T00:00:00.0000000, expected: "05/22/2024 00:00:00") (1ms)
    Assert.Equal() Failure: Strings differ
               ↓ (pos 0)
    Expected: "05/22/2024 00:00:00"
    Actual:   "5/22/2024 12:00:00 AM"
               ↑ (pos 0)

I had to transfer expected in to method. Since the resource was static and used culture before the attribute of modify culture was triggered. Yes, there is another option at a higher level to do this for example through itestpipelinestartup. But I don't think this is a good idea.

Zombach avatar Apr 30 '25 08:04 Zombach