Example #1
0
        void InitializeDocumentStore()
        {
            _documentStore = _configuration.CreateDocumentStore();

            var keyGenerator = new SequentialKeyGenerator(_documentStore);

            _documentStore.Conventions.DocumentKeyGenerator = (a, b, c) => string.Format("{0}/{1}", CollectionName, keyGenerator.NextFor <IEvent>());
            //_documentStore.Conventions.IdentityTypeConvertors.Add(new ConceptTypeConverter<long>());
            //_documentStore.Conventions.IdentityTypeConvertors.Add(new ConceptTypeConverter<int>());
            //_documentStore.Conventions.IdentityTypeConvertors.Add(new ConceptTypeConverter<string>());
            //_documentStore.Conventions.IdentityTypeConvertors.Add(new ConceptTypeConverter<Guid>());
            //_documentStore.Conventions.IdentityTypeConvertors.Add(new ConceptTypeConverter<short>());

            _documentStore.Conventions.CustomizeJsonSerializer = s =>
            {
                s.Converters.Add(new MethodInfoConverter());
                s.Converters.Add(new EventSourceVersionConverter());
                s.Converters.Add(new ConceptConverter());
            };

            var originalFindTypeTagNam = _documentStore.Conventions.FindTypeTagName;

            _documentStore.Conventions.FindTypeTagName = t =>
            {
                if (t.HasInterface <IEvent>() || t == typeof(IEvent))
                {
                    return(CollectionName);
                }
                return(originalFindTypeTagNam(t));
            };

            _documentStore.RegisterListener(new EventMetaDataListener(_eventMigrationHierarchyManager));
        }
Example #2
0
        void InitializeDocumentStore()
        {
            _documentStore = _configuration.CreateDocumentStore();

            var keyGenerator = new SequentialKeyGenerator(_documentStore);
            _documentStore.Conventions.DocumentKeyGenerator = (a,b,c) => string.Format("{0}/{1}", CollectionName, keyGenerator.NextFor<IEvent>());
            //_documentStore.Conventions.IdentityTypeConvertors.Add(new ConceptTypeConverter<long>());
            //_documentStore.Conventions.IdentityTypeConvertors.Add(new ConceptTypeConverter<int>());
            //_documentStore.Conventions.IdentityTypeConvertors.Add(new ConceptTypeConverter<string>());
            //_documentStore.Conventions.IdentityTypeConvertors.Add(new ConceptTypeConverter<Guid>());
            //_documentStore.Conventions.IdentityTypeConvertors.Add(new ConceptTypeConverter<short>());

            _documentStore.Conventions.CustomizeJsonSerializer = s =>
            {
                s.Converters.Add(new MethodInfoConverter());
                s.Converters.Add(new EventSourceVersionConverter());
                s.Converters.Add(new ConceptConverter());
            };
            
           var originalFindTypeTagNam =  _documentStore.Conventions.FindTypeTagName;
           _documentStore.Conventions.FindTypeTagName = t =>
           {
               if (t.HasInterface<IEvent>() || t == typeof(IEvent)) return CollectionName;
               return originalFindTypeTagNam(t);
           };

            _documentStore.RegisterListener(new EventMetaDataListener(_eventMigrationHierarchyManager));
        }
        public void ShouldResetStepCountForNewScenario()
        {
            var sut = new SequentialKeyGenerator();

            sut.GetStepId(null);
            sut.GetScenarioId(null);

            Assert.That(sut.GetStepId(null), Is.EqualTo("step-2-1"));
        }
        public void ShouldIncrementStepIdForEachRequestForStepId()
        {
            var sut = new SequentialKeyGenerator();

            for (int i = 1; i <= 12; i++)
            {
                Assert.That(sut.GetStepId(null), Is.EqualTo("step-1-" + i));
            }
        }
Example #5
0
        public void ShouldResetStepCountForNewScenario()
        {
            var sut = new SequentialKeyGenerator();

            sut.GetStepId();
            sut.GetScenarioId();

            sut.GetStepId().ShouldBe("step-2-1");
        }
Example #6
0
        public void ShouldIncrementStepIdForEachRequestForStepId()
        {
            var sut = new SequentialKeyGenerator();

            for (int i = 1; i <= 12; i++)
            {
                sut.GetStepId().ShouldBe("step-1-" + i);
            }
        }
Example #7
0
        public void ShouldIncrementScenarioIdForEachRequestForScenariId()
        {
            var sut = new SequentialKeyGenerator();

            for (int i = 1; i <= 12; i++)
            {
                Assert.That(sut.GetScenarioId(), Is.EqualTo("scenario-" + i));
            }
        }