コード例 #1
0
        public void Setup()
        {
            _sparkCoreSettings = A.Fake<Configuration.ISparkCore>();
            A.CallTo(() => _sparkCoreSettings.AccessToken).Returns("0123456789abcdef123456");
            A.CallTo(() => _sparkCoreSettings.DefaultIndexName).Returns("CoreIndex");
            A.CallTo(() => _sparkCoreSettings.DefaultInterval).Returns(TimeSpan.FromSeconds(100));
            A.CallTo(() => _sparkCoreSettings.DefaultType).Returns("CoreType");
            A.CallTo(() => _sparkCoreSettings.Devices).Returns(new[] { _deviceA, _deviceB });

            _elasticSearchSettings = A.Fake<Configuration.IElasticSearch>();
            A.CallTo(() => _elasticSearchSettings.Host).Returns("http://localhost:9220");
            A.CallTo(() => _elasticSearchSettings.Indexes).Returns(new[] { _tempIndex, _humidityIndex, _lightIndex });

            _settings = A.Fake<Configuration.ISettings>();
            A.CallTo(() => _settings.SparkCore).Returns(_sparkCoreSettings);
            A.CallTo(() => _settings.ElasticSearch).Returns(_elasticSearchSettings);

            _sparkApi = A.Fake<Io.Spark.IApi>();
            _documentFactory = A.Fake<Document.IFactory>();
            _schedulerProvider = A.Fake<ISchedulerProvider>();
            _testScheduler = new TestScheduler();
            A.CallTo(() => _schedulerProvider.AsyncScheduler).Returns(_testScheduler);

            _subject = new SparkSource(_settings, _sparkApi, _documentFactory, _schedulerProvider);
        }
コード例 #2
0
        public void Setup()
        {
            _elasticSearchSettings = A.Fake<Configuration.IElasticSearch>();
            A.CallTo(() => _elasticSearchSettings.Host).Returns("http://localhost:9220");
            A.CallTo(() => _elasticSearchSettings.Indexes).Returns(new[] { _tempIndex, _humidityIndex, _lightIndex });

            _settings = A.Fake<Configuration.ISettings>();
            A.CallTo(() => _settings.SparkCore).Returns(A.Fake<Configuration.ISparkCore>());
            A.CallTo(() => _settings.ElasticSearch).Returns(_elasticSearchSettings);

            _clock = A.Fake<IClock>();
            A.CallTo(() => _clock.UtcNow).Returns(DateTime.UtcNow);
        }