using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace SWLib
{
    public class Tester
    {
        public static void Main()
        {
            Tester c = new Tester();
            c.Test4();
            
        }

        public void Test4()
        {
            SensorManager sm = new SensorManager();
            PointF[] viewport = new PointF[4];
            SensorType[] stype = new SensorType[2];

            viewport[0] = new PointF(-101.0134,47.2);
            viewport[1] = new PointF(-52.1, 47.3);
            viewport[2] = new PointF(-52.1, 27.3);
            viewport[3] = new PointF(-101.0134,27.3);

            stype[0] = SensorType.Generic;

            SensorInfo[] si = sm.SensorsInsidePolygon(null, viewport, "", stype);

        }

        public void Test3()
        {
            Guid guid = UserManager.GetPassCode("sknath@gmail.com", "Charubak12");
            bool authenticated = UserManager.Authenticate("sknath@gmail.com", guid);

            System.Console.WriteLine(guid + " " + authenticated);
        }
        public void Test2()
        {
            string status;

            SensorInfo s = new SensorInfo("sknath@gmail.com", "sknTest", SensorTypeHelper.LongTypeName(SensorType.Generic), 
                DataTypeHelper.DataTypeEnumToString(DataType.HTML),
                0, 0, 0, "http://www.microsoft.com", "delete", "delete it", "cm", 100, 100);
            SensorManager sm = new SensorManager();
            status = sm.InsertSensor(s);
            status = sm.UpdateSensorLocation("sknath@gmail.com", "sknTest", 1, 1, 1);
            status = sm.GetSensorDescriptionByName("sknath@gmail.com", "sknTest");
            SensorInfo[] sensorList = sm.GetSensorsByPublisher("sknath@gmail.com");
            status = sm.DeleteSensor("sknath@gmail.com", "sknTest");
        }

        public void Test1()
        {
            List<SensorInfo> si = new List<SensorInfo>();
            si.Add(new SensorInfo());
            si.Add(new SensorInfo());
            si.Add(new SensorInfo());
            si[0].altitude = 1;
            si[1].altitude = 2;
            si[2].altitude = 3;

            string serialized = SensorSerializer.SerializeSensorInfoArray(si.ToArray());
            SensorInfo[] si1 = SensorSerializer.DeserializeSensorInfoArray(serialized);
        }
    }
}
