// 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(); }
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)); }
// 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>(); }
public ConfiguredMiniRetriever(QboxType qboxType) { _qboxType = qboxType; }
/// <summary> /// Set the type of the Qbox to build. /// </summary> public QboxBuilder WithType(QboxType qboxType) { _qboxType = qboxType; return(this); }