Beispiel #1
0
        public void CreateMockChannelSetData(ChannelSet channelSet, List <ChannelIndex> indices)
        {
            channelSet.Data = new ChannelData()
            {
                FileUri = "file://",
            };

            if (indices.Count == 1)
            {
                if (indices[0].IndexType == ChannelIndexType.measureddepth)
                {
                    channelSet.SetData(@"[
                            [ [0.0 ], [ [ 1.0, true  ], 2.0,  3.0 ] ],
                            [ [0.1 ], [ [ 1.1, false ], null, 3.1 ] ],
                            [ [0.2 ], [ null,           null, 3.2 ] ],
                            [ [0.3 ], [ [ 1.3, true  ], 2.3,  3.3 ] ]
                        ]");
                }
                else if (indices[0].IndexType == ChannelIndexType.datetime)
                {
                    channelSet.SetData(@"[
                            [ [ ""2016-01-01T00:00:00.0000Z"" ], [ [ 1.0, true  ], 2.0,  3.0 ] ],
                            [ [ ""2016-01-01T00:00:01.0000Z"" ], [ [ 1.1, false ], null, 3.1 ] ],
                            [ [ ""2016-01-01T00:00:02.0000Z"" ], [ null,           null, 3.2 ] ],
                            [ [ ""2016-01-01T00:00:03.0000Z"" ], [ [ 1.3, true  ], 2.3,  3.3 ] ]
                        ]");
                }
            }
            else if (indices.Count == 2)
            {
                if (indices[0].IndexType == ChannelIndexType.measureddepth)
                {
                    channelSet.SetData(@"[
                            [ [0.0, ""2016-01-01T00:00:00.0000Z"" ], [ [1.0, true  ],  2.0,  3.0 ] ],
                            [ [0.1, ""2016-01-01T00:00:01.0000Z"" ], [ [1.1, false ],  null, 3.1 ] ],
                            [ [0.2, ""2016-01-01T00:00:02.0000Z"" ], [ null,           null, 3.2 ] ],
                            [ [0.3, ""2016-01-01T00:00:03.0000Z"" ], [ [1.3, true  ],  2.3,  3.3 ] ]
                        ]");
                }
                else if (indices[0].IndexType == ChannelIndexType.datetime)
                {
                    channelSet.SetData(@"[
                            [ [ ""2016-01-01T00:00:00.0000Z"", 0.0 ], [ [ 1.0, true  ], 2.0,  3.0 ] ],
                            [ [ ""2016-01-01T00:00:01.0000Z"", 0.1 ], [ [ 1.1, false ], null, 3.1 ] ],
                            [ [ ""2016-01-01T00:00:02.0000Z"", 0.2 ], [ null,           null, 3.2 ] ],
                            [ [ ""2016-01-01T00:00:03.0000Z"", 0.3 ], [ [ 1.3, true  ], 2.3,  3.3 ] ]
                        ]");
                }
            }
        }
Beispiel #2
0
        public void ChannelSet200DataAdapter_Can_Update_ChannelSet_With_Middle_Depth_Data()
        {
            var dataGenerator = new DataGenerator();

            var channelIndex = new ChannelIndex {
                Direction = IndexDirection.increasing, IndexType = ChannelIndexType.measureddepth, Mnemonic = "MD", Uom = UnitOfMeasure.m
            };

            ChannelSet.Index   = dataGenerator.List(channelIndex);
            ChannelSet.Channel = new List <Channel>
            {
                new Channel()
                {
                    Uuid     = dataGenerator.Uid(),
                    Citation = new Citation {
                        Title = dataGenerator.Name("ChannelSetTest")
                    },
                    Mnemonic      = "MSG",
                    Uom           = null,
                    ChannelClass  = dataGenerator.ToPropertyKindReference("velocity"),
                    DataType      = EtpDataType.@long,
                    GrowingStatus = ChannelStatus.active,
                    Index         = ChannelSet.Index,
                    StartIndex    = new DepthIndexValue(),
                    EndIndex      = new DepthIndexValue(),
                    SchemaVersion = OptionsIn.DataVersion.Version200.Value
                }
            };

            ChannelSet.Data = new ChannelData();
            ChannelSet.SetData(@"[
                [ [0 ], [ 3.11 ] ],
                [ [100 ], [ 3.12 ] ],
                [ [150 ], [ 3.14 ] ],
                [ [200 ], [ 3.15 ] ],
            ]");

            DevKit.AddAndAssert(ChannelSet);

            ChannelSet.Data = new ChannelData();
            ChannelSet.SetData(@"[
                [ [0 ], [ 3.11 ] ],
                [ [100 ], [ 3.12 ] ],
                [ [120 ], [ 3.13 ] ],
                [ [150 ], [ 3.14 ] ],
                [ [200 ], [ 3.15 ] ],
            ]");

            DevKit.UpdateAndAssert(ChannelSet);

            var mnemonics = ChannelSet.Index.Select(i => i.Mnemonic).Concat(ChannelSet.Channel.Select(c => c.Mnemonic)).ToList();
            var dataOut   = _channelDataProvider.GetChannelData(ChannelSet.GetUri(), new Range <double?>(0, null), mnemonics, null);

            Assert.AreEqual(5, dataOut.Count);
            Assert.AreEqual(2, dataOut[1].Count);
            Assert.AreEqual(3.13, dataOut[2][1][0]);
        }