Commit 02de4a8c authored by Namrata Kedia's avatar Namrata Kedia
Browse files

IoT API

parent 39ccb5ae
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -32,13 +32,13 @@ namespace MockDataGenerator
        /// </summary>
        private static readonly Endpoint[] Endpoints = 
        {
            new Endpoint(HttpMethods.Get, DevicePortal.DeviceFamilyApi),
          /*  new Endpoint(HttpMethods.Get, DevicePortal.DeviceFamilyApi),
            new Endpoint(HttpMethods.Get, DevicePortal.MachineNameApi),
            new Endpoint(HttpMethods.Get, DevicePortal.OsInfoApi),
            new Endpoint(HttpMethods.Get, DevicePortal.BatteryStateApi),
            new Endpoint(HttpMethods.Get, DevicePortal.PowerStateApi),
            new Endpoint(HttpMethods.Get, DevicePortal.IpConfigApi),
            new Endpoint(HttpMethods.Get, DevicePortal.SystemPerfApi),
           */ new Endpoint(HttpMethods.Get, DevicePortal.IpConfigApi),
            /*new Endpoint(HttpMethods.Get, DevicePortal.SystemPerfApi),
            new Endpoint(HttpMethods.Get, DevicePortal.RunningProcessApi),
            new Endpoint(HttpMethods.WebSocket, DevicePortal.SystemPerfApi),
            new Endpoint(HttpMethods.WebSocket, DevicePortal.RunningProcessApi),
@@ -64,7 +64,7 @@ namespace MockDataGenerator
            new Endpoint(HttpMethods.Get, DevicePortal.DeviceNameApi),
            new Endpoint(HttpMethods.Get, DevicePortal.SetTimezoneInfoApi),


            */
        };

        /// <summary>
+45 −6
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ namespace Microsoft.Tools.WindowsDevicePortal.Tests
            Assert.AreEqual(TaskStatus.RanToCompletion, getTask.Status);

            // Check some known things about this response.
            Assert.AreEqual("myrpi3", getTask.Result);
            Assert.AreEqual("beta2", getTask.Result);
        }

        /// <summary>
@@ -120,18 +120,17 @@ namespace Microsoft.Tools.WindowsDevicePortal.Tests
            IpConfiguration ipconfig = getTask.Result;

            // Check some known things about this response.
            Assert.AreEqual(5, ipconfig.Adapters.Count);
            NetworkAdapterInfo adapter = ipconfig.Adapters[0];
            Assert.AreEqual("Bluetooth Device (Personal Area Network)", adapter.Description);
            Assert.AreEqual("b8-27-eb-59-9b-c9", adapter.MacAddress);
            Assert.AreEqual("b8-27-eb-8d-0b-c5", adapter.MacAddress);
            Assert.AreEqual(4, adapter.Index);
            Assert.AreEqual(Guid.Parse("{A41F8777-D1F3-4D9C-AF2E-5D2EEAEF7581}"), adapter.Id);
            Assert.AreEqual("Ethernet", adapter.AdapterType);
            IpAddressInfo ipAddress = adapter.IpAddresses[0];
            Assert.AreEqual("0.0.0.0", ipAddress.Address);
            Assert.AreEqual("0.0.0.0", ipAddress.SubnetMask);
        }

        /// <summary>
        /// Gets the controller driver information using a mock generated on a RasberryPi3.
        /// </summary>
        [TestMethod]
        public void GetControllerDriverInfo_IoT()
        {
@@ -149,6 +148,9 @@ namespace Microsoft.Tools.WindowsDevicePortal.Tests
            // Check some known things about this response.
            Assert.AreEqual("Inbox Driver", controllerDriver.CurrentDriver);
        }
        /// <summary>
        /// Gets the current date time information using a mock generated on a RasberryPi3.
        /// </summary>

        [TestMethod]
        public void GetCurrentDateTimeInfo_IoT()
@@ -170,6 +172,32 @@ namespace Microsoft.Tools.WindowsDevicePortal.Tests
            

        }
        /// <summary>
        /// Gets the timezone information using a mock generated on a RasberryPi3.
        /// </summary>
        [TestMethod]
        public void GetTimezoneInfo_IoT()
        {
            TestHelpers.MockHttpResponder.AddMockResponse(
                DevicePortal.TimezoneInfoApi,
                this.PlatformType,
                this.FriendlyOperatingSystemVersion,
                HttpMethods.Get);

            Task<TimezoneInfo> getTask = TestHelpers.Portal.GetTimezoneInfo();
            getTask.Wait();

            Assert.AreEqual(TaskStatus.RanToCompletion, getTask.Status);
            TimezoneInfo timezone = getTask.Result;
            // Check some known things about this response.

            Assert.AreEqual("(UTC-06:00) Central Time (US & Canada)", timezone.Current.description);
            Assert.AreEqual("(UTC-11:00) Coordinated Universal Time-11", timezone.Timezones[1].description);

        }
        /// <summary>
        /// Gets the device information using a mock generated on a RasberryPi3.
        /// </summary>
        [TestMethod]
        public void GetDeviceInfo_IoT()
        {
@@ -190,6 +218,9 @@ namespace Microsoft.Tools.WindowsDevicePortal.Tests
            Assert.AreEqual("10.0.14393.67", IoTInfo.OSVersion);

        }
        /// <summary>
        /// Gets the status information using a mock generated on a RasberryPi3.
        /// </summary>
        [TestMethod]
        public void GetStatusInfo_IoT()
        {
@@ -210,6 +241,9 @@ namespace Microsoft.Tools.WindowsDevicePortal.Tests
            Assert.AreEqual("Your device is up to date.", stats.updateStatusMessage);

        }
        /// <summary>
        /// Gets the update install time information using a mock generated on a RasberryPi3.
        /// </summary>
        [TestMethod]
        public void GetUpdateInstallTime_IoT()
        {
@@ -228,6 +262,11 @@ namespace Microsoft.Tools.WindowsDevicePortal.Tests
            Assert.AreEqual(0, installTime.rebootscheduled);
            
        }

        /// <summary>
        /// Gets theremote settings status information using a mock generated on a RasberryPi3.
        /// </summary>

        [TestMethod]
        public void GetRemoteSettingsStatus_IoT()
        {
+1 −1
Original line number Diff line number Diff line
{"AvailablePages" : 174889, "CommitLimit" : 249236, "CommittedPages" : 59249, "CpuLoad" : 2, "IOOtherSpeed" : 8484, "IOReadSpeed" : 0, "IOWriteSpeed" : 0, "NonPagedPoolPages" : 7598, "PageSize" : 4096, "PagedPoolPages" : 8501, "TotalInstalledInKb" : 7077968, "TotalPages" : 249236, "GPUData" : {"AvailableAdapters" : [{"DedicatedMemory" : 0, "DedicatedMemoryUsed" : 0, "Description" : "Microsoft Basic Render Driver", "SystemMemory" : 510435328, "SystemMemoryUsed" : 0}]}, "NetworkingData" : {"NetworkInBytes" : 8000, "NetworkOutBytes" : 0}}
 No newline at end of file
{"AvailablePages" : 126137, "CommitLimit" : 249236, "CommittedPages" : 106671, "CpuLoad" : 35, "IOOtherSpeed" : 137781, "IOReadSpeed" : 0, "IOWriteSpeed" : 0, "NonPagedPoolPages" : 7944, "PageSize" : 4096, "PagedPoolPages" : 9183, "TotalInstalledInKb" : 108, "TotalPages" : 249236, "GPUData" : {"AvailableAdapters" : [{"DedicatedMemory" : 0, "DedicatedMemoryUsed" : 0, "Description" : "Microsoft Basic Render Driver", "SystemMemory" : 510435328, "SystemMemoryUsed" : 0}]}, "NetworkingData" : {"NetworkInBytes" : 20000, "NetworkOutBytes" : 108000}}
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
{"Adapters" : [{"Description" : "Bluetooth Device (Personal Area Network)", "HardwareAddress" : "b8-27-eb-59-9b-c9", "Index" : 4, "Name" : "{A41F8777-D1F3-4D9C-AF2E-5D2EEAEF7581}", "Type" : "Ethernet", "DHCP" : {"LeaseExpires" : 0, "LeaseObtained" : 0, "Address" : {"IpAddress" : "", "Mask" : ""}}, "Gateways" : [{"IpAddress" : "0.0.0.0", "Mask" : "255.255.255.255"}], "IpAddresses" : [{"IpAddress" : "0.0.0.0", "Mask" : "0.0.0.0"}]},{"Description" : "LAN9512\/LAN9514 USB 2.0 to Ethernet 10\/100 Adapter", "HardwareAddress" : "b8-27-eb-f3-31-63", "Index" : 2, "Name" : "{0A67EC97-A7E0-424A-B6AD-4BB7D44C7348}", "Type" : "Ethernet", "DHCP" : {"LeaseExpires" : 1471373376, "LeaseObtained" : 1470682176, "Address" : {"IpAddress" : "10.221.226.128", "Mask" : "255.255.255.255"}}, "Gateways" : [{"IpAddress" : "10.137.184.1", "Mask" : "255.255.255.255"}], "IpAddresses" : [{"IpAddress" : "10.137.185.189", "Mask" : "255.255.254.0"}]},{"Description" : "Broadcom 802.11n Wireless SDIO Adapter", "HardwareAddress" : "b8-27-eb-a6-64-36", "Index" : 7, "Name" : "{FAA2B195-2C95-4C94-B708-621873DD4CF1}", "Type" : "IEEE 802.11", "DHCP" : {"LeaseExpires" : 0, "LeaseObtained" : 0, "Address" : {"IpAddress" : "", "Mask" : ""}}, "Gateways" : [{"IpAddress" : "0.0.0.0", "Mask" : "255.255.255.255"}], "IpAddresses" : [{"IpAddress" : "0.0.0.0", "Mask" : "0.0.0.0"}]},{"Description" : "Microsoft Wi-Fi Direct Virtual Adapter", "HardwareAddress" : "ba-27-eb-a6-64-36", "Index" : 3, "Name" : "{3C2BA487-A9AE-4203-BE5C-F55CEB0F72C7}", "Type" : "IEEE 802.11", "DHCP" : {"LeaseExpires" : 0, "LeaseObtained" : 0, "Address" : {"IpAddress" : "", "Mask" : ""}}, "Gateways" : [{"IpAddress" : "0.0.0.0", "Mask" : "255.255.255.255"}], "IpAddresses" : [{"IpAddress" : "0.0.0.0", "Mask" : "0.0.0.0"}]},{"Description" : "Microsoft Wi-Fi Direct Virtual Adapter #2", "HardwareAddress" : "ba-27-eb-a6-6c-36", "Index" : 6, "Name" : "{DED702F6-5F8F-47AC-AE2E-F1264763C4D8}", "Type" : "IEEE 802.11", "Gateways" : [{"IpAddress" : "0.0.0.0", "Mask" : "255.255.255.255"}], "IpAddresses" : [{"IpAddress" : "192.168.137.1", "Mask" : "255.255.255.0"}]}]}
 No newline at end of file
{"Adapters" : [{"Description" : "Bluetooth Device (Personal Area Network)", "HardwareAddress" : "b8-27-eb-8d-0b-c5", "Index" : 4, "Name" : "{56343541-6D1C-47AC-86C7-10FC00F9DBFE}", "Type" : "Ethernet", "DHCP" : {"LeaseExpires" : 0, "LeaseObtained" : 0, "Address" : {"IpAddress" : "", "Mask" : ""}}, "Gateways" : [{"IpAddress" : "0.0.0.0", "Mask" : "255.255.255.255"}], "IpAddresses" : [{"IpAddress" : "0.0.0.0", "Mask" : "0.0.0.0"}]},{"Description" : "LAN9512\/LAN9514 USB 2.0 to Ethernet 10\/100 Adapter", "HardwareAddress" : "b8-27-eb-27-a1-6f", "Index" : 5, "Name" : "{75679A31-C665-4127-B1E8-D7F7EB3DF004}", "Type" : "Ethernet", "DHCP" : {"LeaseExpires" : 1472340068, "LeaseObtained" : 1471648868, "Address" : {"IpAddress" : "10.221.226.128", "Mask" : "255.255.255.255"}}, "Gateways" : [{"IpAddress" : "10.137.184.1", "Mask" : "255.255.255.255"}], "IpAddresses" : [{"IpAddress" : "10.137.184.246", "Mask" : "255.255.254.0"}]},{"Description" : "Broadcom 802.11n Wireless SDIO Adapter", "HardwareAddress" : "b8-27-eb-72-f4-3a", "Index" : 2, "Name" : "{1A22B10D-372B-40CE-A63F-F5E0EA262053}", "Type" : "IEEE 802.11", "DHCP" : {"LeaseExpires" : 0, "LeaseObtained" : 0, "Address" : {"IpAddress" : "", "Mask" : ""}}, "Gateways" : [{"IpAddress" : "0.0.0.0", "Mask" : "255.255.255.255"}], "IpAddresses" : [{"IpAddress" : "0.0.0.0", "Mask" : "0.0.0.0"}]},{"Description" : "Microsoft Wi-Fi Direct Virtual Adapter", "HardwareAddress" : "ba-27-eb-72-f4-3a", "Index" : 3, "Name" : "{4F74DBCB-12C1-4256-ABF0-0B6753DB2010}", "Type" : "IEEE 802.11", "DHCP" : {"LeaseExpires" : 0, "LeaseObtained" : 0, "Address" : {"IpAddress" : "", "Mask" : ""}}, "Gateways" : [{"IpAddress" : "0.0.0.0", "Mask" : "255.255.255.255"}], "IpAddresses" : [{"IpAddress" : "0.0.0.0", "Mask" : "0.0.0.0"}]}]}
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
{"ComputerName" : "myrpi3", "Language" : "en-us", "OsEdition" : "IoTUAP", "OsEditionId" : 123, "OsVersion" : "14393.0.armfre.rs1_release.160715-1616", "Platform" : "Raspberry Pi 3"}
 No newline at end of file
{"ComputerName" : "beta2", "Language" : "en-us", "OsEdition" : "IoTUAP", "OsEditionId" : 123, "OsVersion" : "14393.67.armfre.rs1_release.160804-2231", "Platform" : "Raspberry Pi 3"}
 No newline at end of file
Loading