public void Save_ContentLoadSummary_ValuesIncrement()
{
EventMapper eventMapper = new EventMapper(this.client, this.database);
Guid applicationId = Guid.NewGuid();
Guid deviceId = Guid.NewGuid();
ContentLoadSummary expected = new ContentLoadSummary()
{
ApplicationId = applicationId,
Count = 2,
Date = date,
PlatformId = platform,
Version = version,
Loads = new List<ContentDurationAggregate>()
{
new ContentDurationAggregate("someScreen", "someContent", 46)
{
Count = 2
}
}
};
Event eventItem = new Event()
{
ApplicationId = applicationId,
Date = date,
Version = version,
PlatformId = platform,
DateCreatedOnDevice = dateCreatedOnDevice,
ScreenName = "someScreen",
EventName = "someContent",
DeviceId = deviceId,
DateCreated = date,
Length = 23000
};
ContentLoadSummary summary = new ContentLoadSummary(eventItem);
eventMapper.Save(summary);
eventMapper.Save(summary);
IMongoQuery query = Query.And
(
Query<AppUsageSummary>.EQ<DateTime>(mem => mem.Date, date),
Query<AppUsageSummary>.EQ<Guid>(mem => mem.ApplicationId, applicationId),
Query<AppUsageSummary>.EQ<string>(mem => mem.Version, version),
Query<AppUsageSummary>.EQ<PlatformType>(mem => mem.PlatformId, platform)
);
ContentLoadSummary actual =
this.GetCollection<ContentLoadSummary>().FindOne(query);
actual.ShouldHave().AllPropertiesBut(x => x.Id)
.IncludingNestedObjects().EqualTo(expected);
}