|
[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, ... }
]