public SagaMediatorInitiationsTests()
        {
            var serviceLocator = new DumbServiceLocator();

            repository = new InMemorySagaRepository(new JsonNetSerialiser(), serviceLocator);
            sut        = new SagaMediator(repository, serviceLocator, typeof(SagaMediatorInitiationsTests).Assembly);
        }
Example #2
0
        public static void Main(params string[] args)
        {
            var serviceLocator = new DumbServiceLocator();

            _sagaRepository = new InMemorySagaRepository(new JsonNetSerialiser(), serviceLocator);
            _sagaMediator   = new SagaMediator(_sagaRepository, serviceLocator, typeof(Program).Assembly);

            var correlationId = Guid.NewGuid();

            StartSaga(correlationId);

            RequestVerificationCode(correlationId);

            ProvideVerificationCode(correlationId);

            CreateAccount(correlationId);

            var saga      = _sagaRepository.Find <AccountCreationSaga>(correlationId);
            var jamesName = saga.SagaData.Person.FullName;

            Console.WriteLine($"Taking information from SagaData; Person.FullName='{jamesName}'");

            // and time to remove saga from the storage
            _sagaRepository.Complete(correlationId);

            Console.WriteLine("Press Any Key");
            Console.ReadKey();
        }