Inheritance: System.Item
        public void Save_SummaryRecord_MatchesSummary()
        {
            CrashMapper crashMapper = new CrashMapper(this.client, this.database);
            Guid applicationId = Guid.NewGuid();

            CrashSummary expected = new CrashSummary()
            {
                ApplicationId = applicationId,
                Count = 2,
                Date = date,
                PlatformId = platform,
                Version = version
            };

            Crash crash = new Crash()
            {
                ApplicationId = applicationId,
                DeviceId = Guid.NewGuid(),
                SessionId = Guid.NewGuid(),
                DateCreatedOnDevice = dateCreatedOnDevice,
                Date = date,
                DateCreated = DateTime.Now,
                Version = version,
                PlatformId = platform
            };

            CrashSummary summary = new CrashSummary(crash);
            crashMapper.Save(summary);

            Crash crash2 = new Crash()
            {
                ApplicationId = applicationId,
                DeviceId = Guid.NewGuid(),
                SessionId = Guid.NewGuid(),
                DateCreatedOnDevice = dateCreatedOnDevice,
                Date = date,
                DateCreated = DateTime.Now,
                Version = version,
                PlatformId = platform
            };

            CrashSummary summary2 = new CrashSummary(crash2);
            crashMapper.Save(summary2);

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

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

            actual.ShouldHave().AllPropertiesBut(x => x.Id).EqualTo(expected);
        }
        public void Save_RawRecord_Saves()
        {
            CrashMapper crashMapper = new CrashMapper(this.client, this.database);
            Guid applicationId = Guid.NewGuid();
            Guid deviceId = Guid.NewGuid();

            Crash crash = new Crash()
            {
                ApplicationId = applicationId,
                DeviceId = deviceId,
                SessionId = Guid.NewGuid(),
                DateCreatedOnDevice = dateCreatedOnDevice,
                Version = version,
                Date = date,
                DateCreated = dateCreatedOnDevice,
                PlatformId = platform
            };

            crashMapper.Save(crash);
        }
        public void Log(Crash crash)
        {
            Application application = this.applicationRepository.Find(crash.ApplicationId);

            if (application != null)
            {
                DeviceInfo device = this.deviceRepository.Find(crash.DeviceId);

                if (device != null)
                {
                    string lastScreenBeforeCrash = null;
                    DeviceAppLastScreen appLastScreen =
                        this.eventRepository.GetDeviceAppLastScreenOneBy(crash.DeviceId, crash.ApplicationId);

                    if (appLastScreen != null)
                    {
                        lastScreenBeforeCrash = appLastScreen.ScreenName;
                    }

                    crash.Add(device, lastScreenBeforeCrash);

                    CrashSummary crashSummary = new CrashSummary(crash);

                    this.crashRepository.Save(crash);
                    this.crashRepository.Save(crashSummary);
                }
                else
                {
                    throw new NoDeviceException(crash.DeviceId);
                }
            }
            else
            {
                throw new InactiveApplicationException(crash.ApplicationId);
            }
        }
 public void Save(Crash crash)
 {
     this.crashMapper.Save(crash);
 }
 public CrashSummary(Crash crash)
     : base(crash)
 {
 }
 public CrashSummary(Crash crash)
     : base(crash)
 {
 }
 public void Save(Crash entity)
 {
     base.Save(entity);
 }