コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: Nydxy/rftool
 public MainWindow()
 {
     InitializeComponent();
     this.DataContext = this;
     RfidOption       = new RfidOptions();
     Rfid             = new RfidTool(RfidOption);
     RfidTags         = new Dictionary <string, RfidTagInfo>();
 }
コード例 #2
0
        public void Should_return_initial_rfid_options()
        {
            var opts = new RfidOptions();

            using var storageService = new StorageService(Options
                                                          .Create(new ServiceOptions
            {
                StorageConnectionString = storageConnectionString,
                InitialRfidOptions      = opts
            }), MessageHub, SystemClock);

            var settings = storageService.GetRfidOptions();

            settings.Should().BeSameAs(opts);
        }
コード例 #3
0
        public async Task Should_set_rfid_options()
        {
            var opts = new RfidOptions
            {
                Enabled          = true,
                ConnectionString = "bbb",
                RpsThreshold     = 666,
                CheckpointAggregationWindowMs = 777
            };

            using var svc = CreateCheckpointService();
            var client = new CheckpointServiceClient(svc.ListenUri);
            await client.SetRfidOptions(opts);

            var opts2 = await client.GetRfidOptions();

            opts2.Enabled.Should().Be(true);
            opts2.ConnectionString.Should().Be("bbb");
            opts2.RpsThreshold.Should().Be(666);
            opts2.CheckpointAggregationWindowMs.Should().Be(777);
        }
コード例 #4
0
        public async Task Should_set_rfid_options()
        {
            var opts = new RfidOptions
            {
                Enabled          = true,
                ConnectionString = "bbb",
                RpsThreshold     = 666,
                CheckpointAggregationWindowMs = 777
            };

            using var svc = CreateCheckpointService();
            var client = new HttpClient();

            (await client.PutAsync($"{svc.ListenUri}/options",
                                   new StringContent(JsonConvert.SerializeObject(opts), Encoding.UTF8, "application/json")))
            .EnsureSuccessStatusCode();
            var opts2 = await client.GetAsync <RfidOptions>($"{svc.ListenUri}/options");

            opts2.Enabled.Should().Be(true);
            opts2.ConnectionString.Should().Be("bbb");
            opts2.RpsThreshold.Should().Be(666);
            opts2.CheckpointAggregationWindowMs.Should().Be(777);
        }
コード例 #5
0
 public void Put([FromBody] RfidOptions options)
 {
     storageService.SetRfidOptions(options);
 }
コード例 #6
0
 public void Put([FromBody] RfidOptions options)
 {
     checkpointRepository.SetRfidOptions(options);
 }