Skip to content
This repository has been archived by the owner on Apr 11, 2022. It is now read-only.

DateTime gets rounded #39

Open
gldraphael opened this issue Aug 24, 2018 · 0 comments
Open

DateTime gets rounded #39

gldraphael opened this issue Aug 24, 2018 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@gldraphael
Copy link
Owner

[Fact(Skip = "DateTime fails")]
public async Task Return_all_events()
{
// Arrange
var createdOn = DateTime.Now;
var posts = new List<EventPostDM>(new EventPostDM[] {
new EventPostDM { CreatedOn = createdOn, Slug = "well-im-gonna-keep-on-waking" },
new EventPostDM { CreatedOn = createdOn, Slug = "and-rising-up-before-the-sun" },
new EventPostDM { CreatedOn = createdOn, Slug = "and-lying-in-the-dark-wide-awake" },
new EventPostDM { CreatedOn = createdOn, Slug = "when-everybody-else-is-done" }
});
await Db.Events.InsertManyAsync(posts);
// Act
var result = await new AllEventsQuery(Db).QueryAsync();
// Assert
Assert.Equal(posts.Count, result.Count);
Assert.Equal(posts.Adapt<IList<EventPost>>(), result);
}

Using DateTime.UtcNow

Expected:

List<EventPost> [
    EventPost { Announcements = [...], Body = null, CreatedOn = 2018-08-24T15:53:21.5066390Z, Description = null, EndDate = null, ... }, 
    EventPost { Announcements = [...], Body = null, CreatedOn = 2018-08-24T15:53:21.5068960Z, Description = null, EndDate = null, ... }, 
    EventPost { Announcements = [...], Body = null, CreatedOn = 2018-08-24T15:53:21.5068980Z, Description = null, EndDate = null, ... }, 
    EventPost { Announcements = [...], Body = null, CreatedOn = 2018-08-24T15:53:21.5068980Z, Description = null, EndDate = null, ... }
]

Actual:

List<EventPost> [
    EventPost { Announcements = [...], Body = null, CreatedOn = 2018-08-24T15:53:21.5060000Z, Description = null, EndDate = null, ... }, 
    EventPost { Announcements = [...], Body = null, CreatedOn = 2018-08-24T15:53:21.5060000Z, Description = null, EndDate = null, ... }, 
    EventPost { Announcements = [...], Body = null, CreatedOn = 2018-08-24T15:53:21.5060000Z, Description = null, EndDate = null, ... }, 
    EventPost { Announcements = [...], Body = null, CreatedOn = 2018-08-24T15:53:21.5060000Z, Description = null, EndDate = null, ... }
]

Using DateTime.Now

Expected:

List<EventPost> [
    EventPost { Announcements = [...], Body = null, CreatedOn = 2018-08-24T21:31:14.8523690+05:30, Description = null, EndDate = null, ... }, 
    EventPost { Announcements = [...], Body = null, CreatedOn = 2018-08-24T21:31:14.8523690+05:30, Description = null, EndDate = null, ... }, 
    EventPost { Announcements = [...], Body = null, CreatedOn = 2018-08-24T21:31:14.8523690+05:30, Description = null, EndDate = null, ... }, 
    EventPost { Announcements = [...], Body = null, CreatedOn = 2018-08-24T21:31:14.8523690+05:30, Description = null, EndDate = null, ... }
]

Actual:

List<EventPost> [
    EventPost { Announcements = [...], Body = null, CreatedOn = 2018-08-24T16:01:14.8520000Z, Description = null, EndDate = null, ... }, 
    EventPost { Announcements = [...], Body = null, CreatedOn = 2018-08-24T16:01:14.8520000Z, Description = null, EndDate = null, ... }, 
    EventPost { Announcements = [...], Body = null, CreatedOn = 2018-08-24T16:01:14.8520000Z, Description = null, EndDate = null, ... }, 
    EventPost { Announcements = [...], Body = null, CreatedOn = 2018-08-24T16:01:14.8520000Z, Description = null, EndDate = null, ... }
]
@gldraphael gldraphael added the bug Something isn't working label Aug 24, 2018
@gldraphael gldraphael added this to the v0.1.0 milestone Aug 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant