Наследование: NoSqlBase, IEventMapper
        public void Save_AppUsageDurationSummary_ValuesIncrement()
        {
            EventMapper eventMapper = new EventMapper(this.client, this.database);
            Guid applicationId = Guid.NewGuid();
            Guid deviceId = Guid.NewGuid();

            AppUsageDurationSummary expected = new AppUsageDurationSummary()
            {
                ApplicationId = applicationId,
                Count = 2,
                Date = date,
                PlatformId = platform,
                Version = version,
                LengthGroup = new SessionLengthGroup()
                {
                    _20sec = 2
                }
            };

            Event eventItem = new Event()
            {
                ApplicationId = applicationId,
                Date = date,
                Version = version,
                PlatformId = platform,
                DateCreatedOnDevice = dateCreatedOnDevice,
                ScreenName = "someScreen",
                EventName = "someEvent",
                DeviceId = deviceId,
                DateCreated = date,
                Length = 20000
            };

            AppUsageDurationSummary summary = new AppUsageDurationSummary(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)
                );

            AppUsageDurationSummary actual =
                this.GetCollection<AppUsageDurationSummary>().FindOne(query);

            actual.ShouldHave().AllPropertiesBut(x => x.Id)
                .IncludingNestedObjects().EqualTo(expected);
        }
        public void Save_AppUsageSummary_ValuesIncrement()
        {
            EventMapper eventMapper = new EventMapper(this.client, this.database);
            Guid applicationId = Guid.NewGuid();
            Guid deviceId = Guid.NewGuid();

            AppUsageSummary expected = new AppUsageSummary()
            {
                ApplicationId = applicationId,
                Count = 2,
                Date = date,
                PlatformId = platform,
                Version = version,
                TimeGroup = new TimeOfDayGroup()
                {
                    _10 = 2
                },
                WeekGroup = new DayOfWeekGroup()
                {
                    Wed = 2
                },
                FrequencyUsageGroup = new FrequencyOfUsageGroup(),
                DevicesVisits = new List<DeviceAppVisit>()
                {
                    new DeviceAppVisit(deviceId)
                    {
                        Count = 2
                    }
                },
                NewReturningGroup = new NewReturningGroup(2, 0)
            };

            Event eventItem = new Event()
            {
                ApplicationId = applicationId,
                Date = date,
                Version = version,
                PlatformId = platform,
                DateCreatedOnDevice = dateCreatedOnDevice,
                DeviceId = deviceId,
                DateCreated = date
            };

            AppUsageSummary summary = new AppUsageSummary(eventItem, null);

            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)
                );

            AppUsageSummary actual = this.GetCollection<AppUsageSummary>().FindOne(query);

            actual.ShouldHave().AllPropertiesBut(x => x.Id)
                .IncludingNestedObjects().EqualTo(expected);
        }
        public void Save_ScreenRoute_ValuesIncrement()
        {
            EventMapper eventMapper = new EventMapper(this.client, this.database);
            Guid applicationId = Guid.NewGuid();
            Guid deviceId = Guid.NewGuid();

            ScreenRouteSummary expected = new ScreenRouteSummary()
            {
                ApplicationId = applicationId,
                Count = 2,
                Date = date,
                PlatformId = platform,
                Version = version,
                ScreenRoutes = new List<ScreenRoute>()
                {
                     new ScreenRoute("screenNameBefore", "screenNameAfter")
                     {
                         Count = 2
                     }
                }
            };

            Event eventItem = new Event()
            {
                ApplicationId = applicationId,
                Date = date,
                Version = version,
                PlatformId = platform,
                DateCreatedOnDevice = dateCreatedOnDevice,
                DeviceId = deviceId,
                DateCreated = date,
                EventTypeId = Model.Enum.EventType.ScreenOpen,
                ScreenName = "screenNameAfter"
            };

            ScreenRouteSummary summary = new ScreenRouteSummary(eventItem, "screenNameBefore", "screenNameAfter");

            eventMapper.Save(summary);
            eventMapper.Save(summary);

            IMongoQuery query = Query.And
                (
                    Query<ScreenRouteSummary>.EQ<DateTime>(mem => mem.Date, date),
                    Query<ScreenRouteSummary>.EQ<Guid>(mem => mem.ApplicationId, applicationId),
                    Query<ScreenRouteSummary>.EQ<string>(mem => mem.Version, version),
                    Query<ScreenRouteSummary>.EQ<PlatformType>(mem => mem.PlatformId, platform)
                );

            ScreenRouteSummary actual = this.GetCollection<ScreenRouteSummary>().FindOne(query);

            actual.ShouldHave().AllPropertiesBut(x => x.Id).IncludingNestedObjects().EqualTo(expected);
        }