コード例 #1
0
        static void Main(string[] args)
        {
            var eventStore = new EventStoreMock();
            var keyStore   = new KeyStoreMock();
            var repository = new EventRepository(eventStore, keyStore);

            UserRegistrationCommandService = new UserRegistrationCommandService(repository);
            UserRegistrationQueryService   = new UserRegistrationQueryService(repository);

            while (!ExitCommandGiven)
            {
                Parser
                .Default
                .ParseArguments <AddOptions, VerifyOptions, SearchOptions, ExitOptions>(args)
                .MapResult(
                    (AddOptions options) => Add(options).Result,
                    (VerifyOptions options) => Verify(options).Result,
                    (SearchOptions options) => Search(options).Result,
                    (ExitOptions _) => Exit(),
                    errors => 1);

                Console.WriteLine("Provide a command or type help for options");
                args = Console.ReadLine().Split(' ');
            }
        }
        public void Initialize()
        {
            EventStore = new EventStoreMock();
            KeyStore   = new KeyStoreMock();

            var eventRepository = new EventRepository(EventStore, KeyStore);

            UserRegistrationCommandService = new UserRegistrationCommandService(eventRepository);
            UserRegistrationQueryService   = new UserRegistrationQueryService(eventRepository);
        }