예제 #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 });
 }
예제 #2
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 });
 }
예제 #3
0
            protected override void EstablishContext()
            {
                base.EstablishContext();
                IoDevice = new PHmiModel.Entities.IoDevice
                {
                    Name = "IoDevice",
                    Id   = 1
                };
                IoDevices = new EnumerableQuery <PHmiModel.Entities.IoDevice>(new [] { IoDevice });
                Context.Setup(context => context.Get <PHmiModel.Entities.IoDevice>()).Returns(IoDevices);

                IoDeviceRunTarget = new Mock <IIoDeviceRunTarget>();
                IoDeviceRunTargetFactory.Setup(f => f.Create(TimeService.Object, IoDevice))
                .Returns(IoDeviceRunTarget.Object);
                CyclicRunner = new Mock <ICyclicRunner>();
                CyclicRunnerFactory.Setup(f => f.Create(IoDeviceRunTarget.Object)).Returns(CyclicRunner.Object);
            }
예제 #4
0
            protected override void EstablishContext()
            {
                base.EstablishContext();
                IoDevice = new PHmiModel.Entities.IoDevice
                    {
                        Name = "IoDevice",
                        Id = 1
                    };
                IoDevices = new EnumerableQuery<PHmiModel.Entities.IoDevice>(new [] {IoDevice});
                Context.Setup(context => context.Get<PHmiModel.Entities.IoDevice>()).Returns(IoDevices);

                IoDeviceRunTarget = new Mock<IIoDeviceRunTarget>();
                IoDeviceRunTargetFactory.Setup(f => f.Create(TimeService.Object, IoDevice))
                    .Returns(IoDeviceRunTarget.Object);
                CyclicRunner = new Mock<ICyclicRunner>();
                CyclicRunnerFactory.Setup(f => f.Create(IoDeviceRunTarget.Object)).Returns(CyclicRunner.Object);
            }