コード例 #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
            QboxType qboxType = Configuration.GetValue("QboxType", QboxType.Duo);

            services.AddSingleton <IMiniRetriever>(new ConfiguredMiniRetriever(qboxType));
            services.AddSingleton <IQboxDataDumpContextFactory, QboxDataDumpContextFactory>();

            services
            .Configure <kWhStorageOptions>(Configuration.GetSection("kWhStorage"))
            .AddStorageProvider <kWhStorage>();

            services.AddParsers();
        }
コード例 #2
0
        public void TestRetrieve(string qboxSerial, QboxType qboxType, string expectedStorageId, DeviceMeterType expectedMeterType)
        {
            // Arrange
            var retriever = new ConfiguredMiniRetriever(qboxType);

            // Act
            Mini mini = retriever.Retrieve(qboxSerial);

            // Assert
            Counter generationCounter = mini.Counters.Single((c) => c.CounterId == 1);

            Assert.That(generationCounter.StorageId, Is.EqualTo(expectedStorageId));
            Assert.That(mini.MeterType, Is.EqualTo(expectedMeterType));
        }
コード例 #3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services
            .AddCors()
            .AddMvc()
            .SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
            .AddJsonOptions(options =>
            {
                options.SerializerSettings.Converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter());
            });

            QboxType qboxType = Configuration.GetValue("QboxType", QboxType.Duo);

            services.AddSingleton <IMiniRetriever>(new ConfiguredMiniRetriever(qboxType));

            services
            .Configure <kWhStorageOptions>(Configuration.GetSection("kWhStorage"))
            .AddStorageProvider <kWhStorage>();

            services
            .AddScoped <ISeriesRetriever, SeriesRetriever>();
        }
コード例 #4
0
 public ConfiguredMiniRetriever(QboxType qboxType)
 {
     _qboxType = qboxType;
 }
コード例 #5
0
ファイル: QboxBuilder.cs プロジェクト: StefH/QboxNext
 /// <summary>
 /// Set the type of the Qbox to build.
 /// </summary>
 public QboxBuilder WithType(QboxType qboxType)
 {
     _qboxType = qboxType;
     return(this);
 }