private static void LoadHalJson <T>(
            out IMessagePublisher publisher,
            out IMessageSubscriber <T> subscriber) where T : new()
        {
            var connectionString = "server=.;database=scratchpad;trusted_connection=true;";
            var pubStoreSproc    = "usp_StoreMessage";
            var pubReceiveSproc  = "usp_GetPageOfMessages";
            var subGetSproc      = "usp_GetLastMessageId";
            var subUpdateSproc   = "usp_UpdateLastMessageId";

            //WriteColoredText("Connection string: ");
            //var connectionString = Console.ReadLine();

            //WriteColoredText("Publish store sproc: ");
            //var pubStoreSproc = Console.ReadLine();

            //WriteColoredText("Publish receive sproc: ");
            //var pubReceiveSproc = Console.ReadLine();

            //WriteColoredText("Receive get sproc: ");
            //var subGetSproc = Console.ReadLine();

            //WriteColoredText("Receive update sproc: ");
            //var subUpdateSproc = Console.ReadLine();

            publisher = new SyndicationMessagePublisher(new SqlServerMessageRepository(connectionString, pubStoreSproc, pubReceiveSproc, 10));

            var feedPositionRepo = new SqlServerFeedPositionRepository(connectionString, subGetSproc, subUpdateSproc);

            subscriber = new SyndicationPollingMessageReceiver <T>(
                new HalJsonMessageClient(feedPositionRepo, new HttpClientWrapper("http://localhost:16972/"), new MessageIdentifierFactory()),
                feedPositionRepo);
        }
Ejemplo n.º 2
0
        public void Arrange()
        {
            _messageRepository = new Mock <IMessageRepository>();

            _publisher = new SyndicationMessagePublisher(_messageRepository.Object);
        }