コード例 #1
0
ファイル: CachedDataAccessorTest.cs プロジェクト: tomyqg/ULA
        public void CashedStorageGetCommandNotFailed()
        {
            var cache = new CachedDataAccessor(this._dataDriver);

            cache.PostDataAsync(null, null,
                                new CancellationToken()).IsFaulted.Should().Be(false);
        }
コード例 #2
0
ファイル: CachedDataAccessorTest.cs プロジェクト: tomyqg/ULA
        public void CashedStorageGetCommandShouldBeNotCanceled()
        {
            var cache = new CachedDataAccessor(this._dataDriver);

            Task.Factory.StartNew(
                () =>
                cache.GetDataAsync(Mock.Of <EntityMetadata>(x => x.StartAddress == 0x1000),
                                   new CancellationToken())).IsCanceled.Should().Be(false);
        }
コード例 #3
0
 public void Initialization()
 {
     //this._simulator = new ModbusDeviceSimulator();
     //this._simulator.CreateDevice("Device1", 4444);
     //this._simulator.RunDevice("Device1");
     //this._simulator.AddNewAddressWithData(4444, 4096, new DateTimeValue(2014));
     //this._simulator.AddNewAddressWithData(4444, 4200, new HexadecimalValue("123"));
     //this._simulator.AddNewAddressWithData(4444, 3333, new BinaryValue(new bool[5]));
     this._driver = new ModbusDataDriver("10.12.89.118", 4444);
     this._driver.Start();
     this._cachedDataAccessor = new CachedDataAccessor(new DriverDataAccessor(this._driver));
 }
コード例 #4
0
ファイル: CachedDataAccessorTest.cs プロジェクト: tomyqg/ULA
        public void CashedStoragePostCommandAndThenReadInformationFromCache()
        {
            var cache = new CachedDataAccessor(this._dataDriver);

            cache.PostDataAsync(new EntityMetadata {
                StartAddress = 1000
            }, new Byte[] { 1, 2, 3, 5 },
                                new CancellationToken()).RunSynchronously();
            cache.GetDataAsync(new EntityMetadata {
                StartAddress = 1000, NumberOfPoints = 10
            },
                               new CancellationToken()).RunSynchronously();
        }
コード例 #5
0
ファイル: CachedDataAccessorTest.cs プロジェクト: tomyqg/ULA
        public void CashedStoragePostCommandNotCompleted()
        {
            var cache     = new CachedDataAccessor(this._dataDriver);
            var beforeRun = cache.PostDataAsync(new EntityMetadata {
                StartAddress = 1000
            }, new Byte[] { 1, 2, 3, 5 },
                                                new CancellationToken()).IsCompleted;

            cache.PostDataAsync(new EntityMetadata {
                StartAddress = 1000
            }, new Byte[] { 1, 2, 3, 5 },
                                new CancellationToken()).RunSynchronously();
            beforeRun.Should().Be(false);
        }