コード例 #1
0
        /// <summary>
        /// Набор сообщений по действиям по моделям SGSPointData
        /// </summary>
        /// <param name="SGSPointsData">Набор моделей SGSPointData для проверки на необходимость вставки обновления с последующим проведением операции</param>
        /// <returns></returns>
        public static List <Messadge> Put(IEnumerable <SGSPointData> SGSPointsData)
        {
            var res = new UniversalModel <Messadge>();
            var pdp = new SGSPDPut();

            pdp.AddRange(SGSPointsData);
            res.QParameters.Add(new SqlParameter("@SGSPDPut", pdp.ToXMLString()));
            return(res.GetFromDBList("PutPointData"));
        }
コード例 #2
0
        public void SGSPDPutToXMLStringTest()
        {
            var res = new SGSPDPut();

            res.Add(new SGSPointData {
                IdSGSPoint   = 4,
                PointValue   = 5.112,
                DateOfValue  = new DateTime(2020, 4, 1, 0, 5, 0, 0),
                Explantation = "added on unit test"
            });
            res.Add(new SGSPointData {
                IdSGSPoint   = 4,
                PointValue   = 5.072,
                DateOfValue  = new DateTime(2020, 4, 1, 0, 6, 0, 0),
                Explantation = "added on unit test"
            });
            res.Add(new SGSPointData {
                IdSGSPoint   = 4,
                PointValue   = 5.046,
                DateOfValue  = new DateTime(2020, 4, 1, 0, 7, 0, 0),
                Explantation = "added on unit test"
            });
            Assert.AreEqual(3, res.DataPoints.Length);
            var exam = @"
<SGSPDPut xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
  <DataPoints>
    <SGSPointData>
      <Id>0</Id>
      <IdSGSPoint>4</IdSGSPoint>
      <DateOfValue>2020-04-01T00:05:00</DateOfValue>
      <PointValue>5.112</PointValue>
      <Explantation>added on unit test</Explantation>
    </SGSPointData>
    <SGSPointData>
      <Id>0</Id>
      <IdSGSPoint>4</IdSGSPoint>
      <DateOfValue>2020-04-01T00:06:00</DateOfValue>
      <PointValue>5.072</PointValue>
      <Explantation>added on unit test</Explantation>
    </SGSPointData>
    <SGSPointData>
      <Id>0</Id>
      <IdSGSPoint>4</IdSGSPoint>
      <DateOfValue>2020-04-01T00:07:00</DateOfValue>
      <PointValue>5.046</PointValue>
      <Explantation>added on unit test</Explantation>
    </SGSPointData>
  </DataPoints>
</SGSPDPut>";

            Console.WriteLine(res.ToXMLString());
            Assert.AreEqual(exam, res.ToXMLString());
        }