Exemple #1
0
        public void TestFixtureSetUp()
        {
            _server = new EmbeddedMongoDbServer();
            var mongoClient = _server.Client;

            //var mongoClient = new MongoClient("mongodb://localhost:27017");

            // requires an instance of mongodb running at localhost
            _db = mongoClient.GetServer().GetDatabase("MassTransit-SagaTest");

            _machine = new SuperShopper();

            _repository = new MongoDbAutomatonymousSagaRepository <ShoppingChore, SuperShopper>(_db, _machine);

            _correlationId = NewId.NextGuid();

            _test = TestFactory.ForSaga <ShoppingChore>().New(x =>
            {
                x.UseStateMachineBuilder(_machine);

                x.UseSagaRepository(_repository);

                x.Publish(new GirlfriendYelling
                {
                    CorrelationId = _correlationId
                });

                x.Publish(new GotHitByACar
                {
                    CorrelationId = _correlationId
                });
            });

            _test.Execute();
        }
Exemple #2
0
        public void Setup()
        {
            _machine = new SuperShopper();
            AutomatonymousStateUserType <SuperShopper> .SaveAsString(_machine);

            _sessionFactory         = new SqlLiteSessionFactoryProvider(typeof(ShoppingChoreMap)).GetSessionFactory();
            _repository             = new NHibernateSagaRepository <ShoppingChore>(_sessionFactory);
            _stateMachineRepository = new AutomatonymousStateMachineSagaRepository <ShoppingChore>(_repository,
                                                                                                   x => false, Enumerable.Empty <StateMachineEventCorrelation <ShoppingChore> >());
            _correlationId = NewId.NextGuid();

            _test = TestFactory.ForSaga <ShoppingChore>().New(x =>
            {
                x.UseStateMachineBuilder(_machine);

                x.UseSagaRepository(_stateMachineRepository);

                x.Publish(new GirlfriendYelling
                {
                    CorrelationId = _correlationId
                });

                x.Publish(new GotHitByACar
                {
                    CorrelationId = _correlationId
                });
            });

            _test.Execute();
        }
Exemple #3
0
        public void Setup()
        {
            _machine = new SuperShopper();
            AutomatonymousStateUserType <SuperShopper> .SaveAsString(_machine);

            _sessionFactory = new SQLiteSessionFactoryProvider(typeof(ShoppingChoreMap))
                              .GetSessionFactory();
        }
Exemple #4
0
        public void Setup()
        {
            _machine                = new SuperShopper();
            _sessionFactory         = new SqlLiteSessionFactoryProvider(typeof(ShoppingChoreMap)).GetSessionFactory();
            _repository             = new NHibernateSagaRepository <ShoppingChore>(_sessionFactory);
            _stateMachineRepository = new AutomatonymousStateMachineSagaRepository <ShoppingChore>(_repository,
                                                                                                   x => x.CurrentState == _machine.Final, new StateMachineEventCorrelation <ShoppingChore>[] {});

            _test = TestFactory.ForSaga <ShoppingChore>().New(x =>
            {
                x.UseStateMachineBuilder(_machine);

                x.UseSagaRepository(_stateMachineRepository);

                x.Publish(new GirlfriendYelling
                {
                    CorrelationId = NewId.NextGuid()
                });
            });

            _test.Execute();
        }