Beispiel #1
0
        public void Test_canGetSystemTimeResponseAndTimeCloseToRealTimeWithWorkingURIAsync_forFormatDateAndTime()
        {
            Uri serverIp = new Uri(serverProtAndIp_success, UriKind.Absolute);

            PortableGeneralInterfaceLibraryAsync alpha = new PortableGeneralInterfaceLibraryAsync();

            PortableGeneralInterfaceLibraryAsync.Enum_TimeFormat tf = PortableGeneralInterfaceLibraryAsync.Enum_TimeFormat.DateAndTime;

            var response = alpha.GetSystemTimeAsync(serverIp, tf);

            var replyTime = (from node in response.Result.Descendants("Reply")
                             select new
            {
                Time = node.Element("Time").Value.ToString()
            }).Single();

            DateTime dateTimeOnDevice;

            if (DateTime.TryParseExact(replyTime.Time, "ddd MMM dd,yyyy-hh:mm:ss tt", null, DateTimeStyles.None, out dateTimeOnDevice))
            {
                TimeSpan timeDifference = DateTime.Now - dateTimeOnDevice;

                Assert.IsTrue(timeDifference.Seconds < 5);
            }
            else
            {
                Assert.Inconclusive("could not parse the datetime from the device, so cannot deterime if the times are close");
            }
        }
Beispiel #2
0
        public void Test_canGetBoardInfoResponseAsNotEmptyWithFailingURIAsync()
        {
            Uri serverIp = new Uri(serverProtAndIp_failure, UriKind.Absolute);

            PortableGeneralInterfaceLibraryAsync alpha = new PortableGeneralInterfaceLibraryAsync();

            var response = alpha.GetBoardInfoAsync(serverIp);

            string result = response.Result.ToString();

            Assert.AreNotEqual("", result);
        }
Beispiel #3
0
        public void Test_canGetExternalMediaStatusResponseAsNotEmptyWithWorkingURIAsync()
        {
            Uri serverIp = new Uri(serverProtAndIp_success, UriKind.Absolute);

            PortableGeneralInterfaceLibraryAsync alpha = new PortableGeneralInterfaceLibraryAsync();

            var response = alpha.GetExternalMediaStatusAsync(serverIp);

            string result = response.Result.ToString();

            Assert.AreNotEqual("", result);
        }
Beispiel #4
0
        public void Test_canGetSystemTimeResponseAsNotEmptyWithFailingURIAsync_forFormatXMLTV()
        {
            Uri serverIp = new Uri(serverProtAndIp_failure, UriKind.Absolute);

            PortableGeneralInterfaceLibraryAsync alpha = new PortableGeneralInterfaceLibraryAsync();

            PortableGeneralInterfaceLibraryAsync.Enum_TimeFormat tf = PortableGeneralInterfaceLibraryAsync.Enum_TimeFormat.XMLTV;

            var response = alpha.GetSystemTimeAsync(serverIp, tf);

            string result = response.Result.ToString();

            Assert.AreNotEqual("", result);
        }
Beispiel #5
0
        public void Test_canGetBoardInfoResponseFailureCodeWithFailingURIAsync()
        {
            Uri serverIp = new Uri(serverProtAndIp_failure, UriKind.Absolute);

            PortableGeneralInterfaceLibraryAsync alpha = new PortableGeneralInterfaceLibraryAsync();

            var response = alpha.GetBoardInfoAsync(serverIp);

            var successCode = (from node in response.Result.Descendants("Status")
                               select new
            {
                ErrorCode = node.Element("ErrorCode").Value.ToString()
            }).Single();

            Assert.AreEqual("10002", successCode.ErrorCode);
        }
Beispiel #6
0
        public void Test_canGetExternalMediaStatusResponseSuccessCodeWithWorkingURIAsync()
        {
            Uri serverIp = new Uri(serverProtAndIp_success, UriKind.Absolute);

            PortableGeneralInterfaceLibraryAsync alpha = new PortableGeneralInterfaceLibraryAsync();

            var response = alpha.GetExternalMediaStatusAsync(serverIp);

            var successCode = (from node in response.Result.Descendants("Status")
                               select new
            {
                ErrorCode = node.Element("ErrorCode").Value.ToString()
            }).Single();

            Assert.AreEqual("0", successCode.ErrorCode);
        }
Beispiel #7
0
        public void Test_canGetSystemTimeResponseFailureCodeWithFailingURIAsync_forFormatDateAndTime()
        {
            Uri serverIp = new Uri(serverProtAndIp_failure, UriKind.Absolute);

            PortableGeneralInterfaceLibraryAsync alpha = new PortableGeneralInterfaceLibraryAsync();

            PortableGeneralInterfaceLibraryAsync.Enum_TimeFormat tf = PortableGeneralInterfaceLibraryAsync.Enum_TimeFormat.DateAndTime;

            var response = alpha.GetSystemTimeAsync(serverIp, tf);

            var successCode = (from node in response.Result.Descendants("Status")
                               select new
            {
                ErrorCode = node.Element("ErrorCode").Value.ToString()
            }).Single();

            Assert.AreEqual("10000", successCode.ErrorCode);
        }