Ejemplo n.º 1
0
        public RedisDatabaseFixture()
        {
            container = new Ductus.FluentDocker.Builders.Builder()
                        .UseContainer()
                        .WithHostName("localhost")
                        .UseImage("redis")
                        .ExposePort(6379, 6379)
                        .WaitForPort("6379/tcp", TimeSpan.FromSeconds(30))
                        .Build()
                        .Start();

            IConnectionMultiplexer connection = ConnectionMultiplexer.Connect("localhost");

            Database = connection.GetDatabase();

            // Load sample data
            IWordService wordService = new FakeWordService();

            completionService = new RedisCompletionService(Database);

            if (!completionService.Exists)
            {
                IEnumerable <string> words = wordService.Get();

                completionService.AddRange(words);
            }
        }