Example #1
0
        private void ValidateStore(IQueueStore store)
        {
            Assert.True(store.VerifyStoreIsUsable());

            // delete any old reports
            store.Cleanup(DateTime.Now);
            IEnumerable <Manifest> manifests = store.GetManifests(null);

            Assert.Equal(manifests.Count(), 0);

            Error error = CreateSampleError();

            Exceptionless.Queue.QueueManager.SerializeErrorExtendedData(_accessor, error);
            store.Enqueue(error);
            manifests = store.GetManifests(null);

            Assert.NotNull(manifests);
            Assert.Equal(manifests.Count(), 1);

            foreach (Manifest m in manifests)
            {
                m.Attempts++;
                m.LastAttempt = DateTime.Now;
                store.UpdateManifest(m);
            }

            manifests = store.GetManifests(null);

            Assert.NotNull(manifests);
            Assert.Equal(manifests.Count(), 1);

            foreach (Manifest m in manifests)
            {
                Assert.Equal(m.Attempts, 1);
                Assert.NotEqual(m.LastAttempt, DateTime.MinValue);

                Error e = store.GetError(m.Id);
                ValidateSampleError(e);

                store.Delete(m.Id);
            }

            manifests = store.GetManifests(null);

            Assert.NotNull(manifests);
            Assert.Equal(manifests.Count(), 0);
        }
        private void ValidateStore(IQueueStore store) {
            Assert.True(store.VerifyStoreIsUsable());

            // delete any old reports
            store.Cleanup(DateTime.Now);
            IEnumerable<Manifest> manifests = store.GetManifests(null);
            Assert.Equal(manifests.Count(), 0);

            Error error = CreateSampleError();
            Exceptionless.Queue.QueueManager.SerializeErrorExtendedData(_accessor, error);
            store.Enqueue(error);
            manifests = store.GetManifests(null);

            Assert.NotNull(manifests);
            Assert.Equal(manifests.Count(), 1);

            foreach (Manifest m in manifests) {
                m.Attempts++;
                m.LastAttempt = DateTime.Now;
                store.UpdateManifest(m);
            }

            manifests = store.GetManifests(null);

            Assert.NotNull(manifests);
            Assert.Equal(manifests.Count(), 1);

            foreach (Manifest m in manifests) {
                Assert.Equal(m.Attempts, 1);
                Assert.NotEqual(m.LastAttempt, DateTime.MinValue);

                Error e = store.GetError(m.Id);
                ValidateSampleError(e);

                store.Delete(m.Id);
            }

            manifests = store.GetManifests(null);

            Assert.NotNull(manifests);
            Assert.Equal(manifests.Count(), 0);
        }