Exemple #1
0
        public void CashedStorageGetCommandNotFailed()
        {
            var cache = new CachedDataAccessor(this._dataDriver);

            cache.PostDataAsync(null, null,
                                new CancellationToken()).IsFaulted.Should().Be(false);
        }
Exemple #2
0
        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);
        }
Exemple #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));
 }
Exemple #4
0
        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();
        }
Exemple #5
0
        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);
        }