Exemplo n.º 1
0
 protected override void EstablishContext()
 {
     base.EstablishContext();
     IoDeviceWrapper        = new Mock <IIoDeviceWrapper>();
     IoDeviceWrapperFactory = new Mock <IIoDeviceWrapperFactory>();
     IoDeviceWrapperFactory.Setup(f => f.Create()).Returns(IoDeviceWrapper.Object);
     IoDevice = new PHmiModel.Entities.IoDevice
     {
         Name    = "IoDeviceRunTargetName",
         Options = IoDeviceOptions,
         Type    = string.Format("{0}{1}{2}", IoDeviceFolder, PHmiConstants.PHmiIoDeviceSeparator, IoDeviceFile)
     };
     DigitalTag = new DigTag
     {
         Id      = 1,
         Device  = "M0",
         CanRead = true
     };
     IoDevice.DigTags.Add(DigitalTag);
     WriteOnlyDigitalTag = new DigTag
     {
         Id      = 2,
         Device  = "M1",
         CanRead = false
     };
     IoDevice.DigTags.Add(WriteOnlyDigitalTag);
     NumericTag = new NumTag
     {
         Id         = 1,
         Device     = "D0",
         NumTagType = new NumTagType {
             Name = "Int32"
         },
         CanRead = true
     };
     IoDevice.NumTags.Add(NumericTag);
     WriteOnlyNumericTag = new NumTag
     {
         Id         = 2,
         Device     = "D1",
         NumTagType = new NumTagType {
             Name = "Int16"
         },
         CanRead = false
     };
     IoDevice.NumTags.Add(WriteOnlyNumericTag);
     Reporter          = new Mock <INotificationReporter>();
     IoDeviceRunTarget = new IoDeviceRunTarget(IoDevice, IoDeviceWrapperFactory.Object, Reporter.Object);
     DigitalTagValue   = true;
     NumericTagValue   = new Random().Next();
     IoDeviceWrapper
     .Setup(w => w.Read(It.IsAny <ReadParameter[]>()))
     .Returns(new object[] { DigitalTagValue, NumericTagValue });
 }
Exemplo n.º 2
0
 public DigTagValueHolder(DigTag tag)
 {
     _address = tag.Device;
 }