bagetter/BaGetter

error executing tests

Closed this issue · 3 comments

Describe the bug

There is an error when executing the test BaGetter.Core.Tests.Metadata.RegistrationBuilderTests.TheRegistrationIndexResponseIsSortedByVersion.

System.ArgumentOutOfRangeException : The UTC time represented when the offset is applied must be between year 0 and 10,000. (Parameter 'offset')

To Reproduce

  1. download current repo as zip
  2. extrat zip
  3. open sln file
  4. open Test Explorer tool window
  5. Run All Tests

Expected behavior

no errors

Screenshots

testlog is better

Additional context

the testlog:

 BaGetter.Core.Tests.Metadata.RegistrationBuilderTests.TheRegistrationIndexResponseIsSortedByVersion
   Source: RegistrationBuilderTests.cs line 19
   Duration: 21 ms

  Message: 
System.ArgumentOutOfRangeException : The UTC time represented when the offset is applied must be between year 0 and 10,000. (Parameter 'offset')

  Stack Trace: 
DateTimeOffset.ValidateDate(DateTime dateTime, TimeSpan offset)
DateTimeOffset.ctor(DateTime dateTime)
DateTimeOffset.op_Implicit(DateTime dateTime)
RegistrationBuilder.ToRegistrationIndexPageItem(Package package) line 61
SelectListIterator`2.Fill(ReadOnlySpan`1 source, Span`1 destination, Func`2 func)
SelectListIterator`2.ToList()
RegistrationBuilder.BuildIndex(PackageRegistration registration) line 24
RegistrationBuilderTests.TheRegistrationIndexResponseIsSortedByVersion() line 40
RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

@FroggieFrog The problem has been solved. Thanks for reporting!

I can confirm, that the mentioned error is fixed. Thank you for that!

There are also some other tests failing dute to \n vs \r\n.
Maybe it is just because I used the download as zip option on GitHub. All files are encoded as \n accordign to VS.

sample testlog from inside VS:

 BaGetter.Tests.ApiIntegrationTests.AutocompleteReturnsEmpty
   Source: ApiIntegrationTests.cs line 122
   Duration: 87 ms

  Message: 
Assert.Equal() Failure: Strings differ
            ↓ (pos 1)
Expected: "{\n  "@context": {\n    "@vocab": "http://s"···
Actual:   "{\r\n  "@context": {\r\n    "@vocab": "http:/"···
            ↑ (pos 1)

  Stack Trace: 
ApiIntegrationTests.AutocompleteReturnsEmpty() line 129
--- End of stack trace from previous location ---
...

Yeah you are right the files should have \r\n. When you are using git you can configure which line endings should be used.