While writing tests for my api, I've noticed an interesting issue. My assertion comparing an object returned by an api with a reference in the database kept failing, while they were querying the same object in the database.
The difference was apparently a microsecond property of
DateTime
DateTime
that did not make it through Json serialization, while EF core returned the full value, thus the objects were different.
Is there a way i could modify serialization properties in asp.net api to transmit the full timestamp without sacrificing data integrity? Or somehow round value to disregard the millisecond property?