Exemplo n.º 1
0
        public static ILocomotive GenerateLocomotive(string name)
        {
            var loco = new LocomotiveMock {
                Name = name
            };

            var section = new SectionMock(loco);

            loco.Sections.Add(section);

            var log = GeneratePsnLog(section);

            //log.LogIntegrity = PsnLogIntegrity.PagesFlowError;
            section.Psns.Add(log);
            section.Psns.Add(GeneratePsnLog(section));
            section.Psns.Add(GeneratePsnLog(section));
            section.Psns.Add(GeneratePsnLog(section));
            section.Psns.Add(GeneratePsnLog(section));
            section.Psns.Add(GeneratePsnLog(section));
            section.Psns.Add(GeneratePsnLog(section));
            section.Psns.Add(GeneratePsnLog(section));
            section.Psns.Add(GeneratePsnLog(section));

            var disp = Dispatcher.CurrentDispatcher;

            _timer = new Timer(state => {
                disp.Invoke(new Action(() => {
                    var t          = (PsnLogMock)section.Psns[0];
                    t.LogIntegrity = PsnLogIntegrity.PagesFlowError;
                }));
            }, null, 10000, 5000);


            return(loco);
        }
Exemplo n.º 2
0
        private static PsnLogMock GeneratePsnLog(SectionMock section)
        {
            var psnLog = new PsnLogMock(section, PsnLogType.PowerDepended,
                                        new PsnConfigurationMock("1.0", "Буровая", "Буровая прошивка", Guid.NewGuid()));

            psnLog.Meters.Add(GenerateMeter(psnLog.BeginTime.Value, "Измеритель 1"));
            psnLog.Meters.Add(GenerateMeter(psnLog.BeginTime.Value, "Измеритель 2"));
            psnLog.Meters.Add(GenerateMeter(psnLog.BeginTime.Value, "Измеритель 3"));
            psnLog.Meters.Add(GenerateMeter(psnLog.BeginTime.Value, "Измеритель 4"));
            psnLog.Meters.Add(GenerateMeter(psnLog.BeginTime.Value, "Измеритель 5"));
            psnLog.Meters.Add(GenerateMeter(psnLog.BeginTime.Value, "Измеритель 6"));


            return(psnLog);
        }
Exemplo n.º 3
0
        private static SectionMock GenerateSection(LocomotiveMock loco, string name)
        {
            var section = new SectionMock(loco)
            {
                Name = name
            };

            section.Psns.Add(new PsnLogMock(section, PsnLogType.FixedLength,
                                            new PsnConfigurationMock("1.0", "Буровая", "Буровая прошивка", Guid.NewGuid())));
            section.Psns.Add(new PsnLogMock(section, PsnLogType.FixedLength,
                                            new PsnConfigurationMock("1.0", "Буровая", "Буровая прошивка", Guid.NewGuid())));

            section.Psns.Add(new PsnLogMock(section, PsnLogType.PowerDepended,
                                            new PsnConfigurationMock("1.0", "Буровая", "Буровая прошивка", Guid.NewGuid())));
            section.Psns.Add(new PsnLogMock(section, PsnLogType.PowerDepended,
                                            new PsnConfigurationMock("1.0", "Буровая", "Буровая прошивка", Guid.NewGuid())));

            section.Faults.Add(new FaultLogMock(section));
            section.Faults.Add(new FaultLogMock(section));
            return(section);
        }
Exemplo n.º 4
0
        public void SetUp()
        {
            _addDataParams = new Mock <IAddDataParameters>();
            _repository    = new Mock <IRepository>();

            InitializeSaveDataAsyncMock(false, OnCompleteEventArgs.CompleteResult.Ok);

            var loco = new LocomotiveMock()
            {
                Name = "Bobo"
            };
            var section = new SectionMock(loco);

            _addDataParams.SetupProperty(m => m.SourceRepository);
            _addDataParams.Object.SourceRepository = _repository.Object;

            _addDataParams.Setup(m => m.ReadLocomotives).
            Returns(new List <ILocomotive>()
            {
                loco
            });

            _addDataParams.Setup(m => m.FaultsToRead).
            Returns(new List <IFaultLog>()
            {
                new FaultLogMock(section), new FaultLogMock(section)
            });

            _addDataParams.Setup(m => m.PsnLogsToRead).
            Returns(new List <IPsnLog>()
            {
                new PsnLogMock(section, PsnLogType.PowerDepended, new PsnConfigurationMock("1.0", "Буровая", "Буровая прошивка", Guid.NewGuid())),
                new PsnLogMock(section, PsnLogType.FixedLength, new PsnConfigurationMock("1.0", "Буровая", "Буровая прошивка", Guid.NewGuid()))
            });

            _messenger = new Messenger();
        }