[Network][TCSACR-167][Add testcase to get DHCP lease duration] 01/186201/1
authorSeonah Moon <seonah1.moon@samsung.com>
Wed, 8 Aug 2018 04:42:47 +0000 (13:42 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Wed, 8 Aug 2018 04:42:51 +0000 (13:42 +0900)
Change-Id: I10182c01503efacd6859b066c207230b45c77395

tct-suite-vs/Tizen.Network.Tests/testcase/TSIAddressInformation.cs

index d3553f2cc41e1957fe92278be8e584e7acb1626d..afbfa8936e6833bc106369fadd2980f15eff9380 100755 (executable)
@@ -485,5 +485,54 @@ namespace Tizen.Network.Connection.Tests
                 }
             }
         }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test DhcpLeaseDuration property of IAddressInformation")]
+        [Property("SPEC", "Tizen.Network.Connection.IAddressInformation.DhcpLeaseDuration A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRO")]
+        [Property("AUTHOR", "Seonah Moon, seonah1.moon@samsung.com")]
+        public static async Task DhcpLeaseDuration_PROPERTY()
+        {
+            Log.Info(Globals.LogTag, "DhcpLeaseDuration_PROPERTY start");
+            ConnectionProfile _connectionProfile = null;
+            try
+            {
+                /** PRECONDITION
+                 * turn on a Public WiFi
+                 **/
+                await setUp();
+
+                /* TEST CODE */
+                _connectionProfile = ConnectionProfileManager.GetCurrentProfile();
+                Assert.IsNotNull(_connectionProfile);
+                var iAddressInformation = _connectionProfile.IPv4Settings;
+                Assert.IsNotNull(iAddressInformation, "IAddressInformation is NULL");
+
+                var duration = iAddressInformation.DhcpLeaseDuration;
+                Assert.IsTrue(duration >= 0, "Invalid dhcp lease duration");
+            }
+            catch (NotSupportedException)
+            {
+                Assert.IsTrue(isWiFiSupported == false, "Invalid NotSupportedException");
+            }
+            catch (TypeInitializationException e)
+            {
+                Assert.IsTrue(isWiFiSupported == false && e.InnerException.GetType() == typeof(NotSupportedException), "Invalid NotSupportedException or TypeInitializationException");
+            }
+            catch (Exception ex)
+            {
+                Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
+            }
+            finally
+            {
+                if (_connectionProfile != null)
+                {
+                    _connectionProfile.Dispose();
+                }
+            }
+
+        }
     }
 }