using NUnit.Framework;
using NUnit.Framework.TUnit;
using System;
-using System.Collections.Generic;\r
-\r
-namespace Tizen.System.Tests\r
+using System.Collections.Generic;
+
+namespace Tizen.System.Tests
{
[TestFixture]
[Description("Tizen.System.PowerUsage Class Tests")]
- public class PowerUsageTests\r
+ public class PowerUsageTests
{
static bool support = true;
static DateTime startTime = DateTime.Now.AddDays(-2);
[Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MR")]
+ [Property("COVPARAM", "string, IList<Tizen.System.PowerUsageResourceType>, DateTime, DateTime")]
[Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
- public void GetPowerUsageByAppForAllResources_CHECK_RESULT()
- {\r
+ public void GetPowerUsage_CHECK_RESULT_BY_APP_FOR_ALL_RESOURCES()
+ {
if (support)
- {\r
- try\r
- {\r
- object powerUsage;\r
- IList<PowerUsageResourceType> rtypes = new List<PowerUsageResourceType>();\r
- rtypes.Add(PowerUsageResourceType.Cpu);\r
- IDictionary<PowerUsageResourceType, double> result = PowerUsage.GetPowerUsage(appID, rtypes, startTime, endTime);\r
-\r
- foreach (PowerUsageResourceType type in rtypes)\r
- {\r
- powerUsage = result[type];\r
- Assert.IsTrue(powerUsage is double, "GetPowerUsage() should return power usage value in double for the resources specified by the application in custom interval");\r
- Assert.IsTrue((double)powerUsage >= 0, "GetPowerUsage() should return usage value for the resources specified by the application in custom interval");\r
- }\r
- }\r
- catch (Exception e)\r
- {\r
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, e.ToString());\r
- Assert.IsTrue(false, e.ToString());\r
+ {
+ try
+ {
+ object powerUsage;
+ IList<PowerUsageResourceType> rtypes = new List<PowerUsageResourceType>();
+ rtypes.Add(PowerUsageResourceType.Cpu);
+ IDictionary<PowerUsageResourceType, double> result = PowerUsage.GetPowerUsage(appID, rtypes, startTime, endTime);
+
+ foreach (PowerUsageResourceType type in rtypes)
+ {
+ powerUsage = result[type];
+ Assert.IsTrue(powerUsage is double, "GetPowerUsage() should return power usage value in double for the resources specified by the application in custom interval");
+ Assert.IsTrue((double)powerUsage >= 0, "GetPowerUsage() should return usage value for the resources specified by the application in custom interval");
+ }
+ }
+ catch (InvalidOperationException)
+ {
+ Assert.Pass("No data record corresponding to given appID");
+ }
+ catch (Exception e)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, e.ToString());
+ Assert.IsTrue(false, e.ToString());
}
}
- else\r
- {\r
- Assert.Pass("Test skipped! Can't test due to not supported exception");\r
+ else
+ {
+ Assert.Pass("Test skipped! Can't test due to not supported exception");
}
}
[Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, IList<Tizen.System.PowerUsageResourceType>, DateTime, DateTime")]
[Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
- public void GetPowerUsageByAppForAllResources_CHECK_NOT_SUPPORTED_EXCEPTION()
- {\r
+ public void GetPowerUsage_CHECK_NOT_SUPPORTED_EXCEPTION_BY_APP_FOR_ALL_RESOURCES()
+ {
if (support)
{
Assert.Pass("Test skipped! Can't test not supported exception");
}
else
- {\r
- try\r
- {\r
- IList<PowerUsageResourceType> rtypes = new List<PowerUsageResourceType>();\r
- foreach (PowerUsageResourceType rtype in Enum.GetValues(typeof(PowerUsageResourceType)))\r
- {\r
- rtypes.Add(rtype);\r
- }\r
- IDictionary<PowerUsageResourceType, double> result = PowerUsage.GetPowerUsage(appID, rtypes, startTime, endTime);\r
- Assert.IsTrue(false, "This operation should raise NotSupportedException");\r
- }\r
- catch (Exception ex)\r
- {\r
- Assert.IsTrue(ex.GetType() == typeof(NotSupportedException), "This operation should raise NotSupportedException");\r
- }\r
- }\r
+ {
+ try
+ {
+ IList<PowerUsageResourceType> rtypes = new List<PowerUsageResourceType>();
+ foreach (PowerUsageResourceType rtype in Enum.GetValues(typeof(PowerUsageResourceType)))
+ {
+ rtypes.Add(rtype);
+ }
+ IDictionary<PowerUsageResourceType, double> result = PowerUsage.GetPowerUsage(appID, rtypes, startTime, endTime);
+ Assert.IsTrue(false, "This operation should raise NotSupportedException");
+ }
+ catch (Exception ex)
+ {
+ Assert.IsTrue(ex.GetType() == typeof(NotSupportedException), "This operation should raise NotSupportedException");
+ }
+ }
}
[Test]
[Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, IList<Tizen.System.PowerUsageResourceType>, DateTime, DateTime")]
[Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
- public void GetPowerUsageByAppForAllResources_CHECK_ARGUMENT_EXCEPTION()
- {\r
+ public void GetPowerUsage_CHECK_ARGUMENT_EXCEPTION_BY_APP_FOR_ALL_RESOURCES()
+ {
if (support)
{
- try\r
- {\r
- IList<PowerUsageResourceType> rtypes = new List<PowerUsageResourceType>();\r
- rtypes.Add(PowerUsageResourceType.Cpu);\r
- IDictionary<PowerUsageResourceType, double> result = PowerUsage.GetPowerUsage(appID, rtypes, DateTime.Now.AddDays(1), DateTime.Now.AddDays(2));\r
- Assert.IsTrue(false, "This operation should raise ArgumentException");\r
+ try
+ {
+ IList<PowerUsageResourceType> rtypes = new List<PowerUsageResourceType>();
+ rtypes.Add(PowerUsageResourceType.Cpu);
+ IDictionary<PowerUsageResourceType, double> result = PowerUsage.GetPowerUsage(appID, rtypes, DateTime.Now.AddDays(-1), DateTime.Now.AddDays(-2));
+ Assert.IsTrue(false, "This operation should raise ArgumentException");
}
- catch (Exception ex)\r
- {\r
- Assert.IsTrue(ex.GetType() == typeof(ArgumentException), "this operation should raise ArgumentException exception");\r
+ catch (Exception ex)
+ {
+ Assert.IsTrue(ex.GetType() == typeof(ArgumentException), "this operation should raise ArgumentException exception");
}
}
else
- {\r
- Assert.Pass("Test skipped! Can't test due to not supported exception");\r
- }\r
+ {
+ Assert.Pass("Test skipped! Can't test due to not supported exception");
+ }
}
[Test]
[Category("P2")]
- [Description("Check if GetPowerUsage() raises invalid operation exception")]
+ [Description("Check if GetPowerUsage() raises argument null exception")]
[Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, IList<Tizen.System.PowerUsageResourceType>, DateTime, DateTime")]
[Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
- public void GetPowerUsageByAppForAllResources_CHECK_INVALID_OPERATION_EXCEPTION()\r
- {\r
- if (support)\r
- {\r
- try\r
- {\r
- IList<PowerUsageResourceType> rtypes = new List<PowerUsageResourceType>();\r
- rtypes.Add(PowerUsageResourceType.Cpu);\r
- IDictionary<PowerUsageResourceType, double> result = PowerUsage.GetPowerUsage(appID, rtypes, startTime, endTime);\r
- Assert.Pass("Test skipped! since no system error occured to test Invalid operation");\r
- }\r
- catch (Exception ex)\r
+ public void GetPowerUsage_CHECK_NULL_ARGUMENT_EXCEPTION_BY_APP_FOR_ALL_RESOURCES()
+ {
+ if (support)
+ {
+ try
+ {
+ IList<PowerUsageResourceType> rtypes = new List<PowerUsageResourceType>();
+ IDictionary<PowerUsageResourceType, double> result = PowerUsage.GetPowerUsage(appID, rtypes, startTime, endTime);
+ Assert.IsTrue(false, "This operation should raise ArgumentNullException");
+ }
+ catch (InvalidOperationException)\r
{\r
- Assert.IsTrue(ex.GetType() == typeof(InvalidOperationException), "This operation will raise InvalidOperationException incase of any system error");\r
+ Assert.Pass("No data record corresponding to given appID");\r
}\r
- }\r
- else\r
- {\r
- Assert.Pass("Test skipped! Can't test due to not supported exception");\r
- }\r
+ catch (Exception ex)
+ {
+ Assert.IsTrue(ex.GetType() == typeof(ArgumentNullException), "this operation should raise ArgumentNullException exception");
+ }
+ }
+ else
+ {
+ Assert.Pass("Test skipped! Can't test due to not supported exception");
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check if GetPowerUsage() raises invalid operation exception")]
+ [Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, IList<Tizen.System.PowerUsageResourceType>, DateTime, DateTime")]
+ [Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
+ public void GetPowerUsage_CHECK_INVALID_OPERATION_EXCEPTION_BY_APP_FOR_ALL_RESOURCES()
+ {
+ if (support)
+ {
+ try
+ {
+ IList<PowerUsageResourceType> rtypes = new List<PowerUsageResourceType>();
+ rtypes.Add(PowerUsageResourceType.Cpu);
+ IDictionary<PowerUsageResourceType, double> result = PowerUsage.GetPowerUsage(appID, rtypes, startTime, endTime);
+ }
+ catch (Exception ex)
+ {
+ Assert.IsTrue(ex.GetType() == typeof(InvalidOperationException), "This operation will raise InvalidOperationException incase of any system error");
+ return;
+ }
+ Assert.Pass("Test skipped! since no system error occured to test Invalid operation");
+ }
+ else
+ {
+ Assert.Pass("Test skipped! Can't test due to not supported exception");
+ }
}
[Test]
[Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MR")]
+ [Property("COVPARAM", "string, Tizen.System.PowerUsageResourceType, DateTime, DateTime")]
[Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
- public void GetPowerUsageByAppPerResource_CHECK_RESULT()
+ public void GetPowerUsage_CHECK_RESULT_BY_APP_PER_RESOURCE()
{
- if (support)\r
- {\r
- try\r
- {\r
- object powerUsage = PowerUsage.GetPowerUsage(appID, PowerUsageResourceType.Cpu, startTime, endTime);\r
- Assert.IsTrue(powerUsage is double, "GetPowerUsage() should return power usage value in double for the specific resource for the given application in custom interval");\r
- Assert.IsTrue((double)powerUsage >= 0, "GetPowerUsage() should return usage value for the specific resource for the given application in custom interval");\r
- }\r
- catch (Exception e)\r
- {\r
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, e.ToString());\r
- Assert.IsTrue(false, e.ToString());\r
- }\r
- }\r
- else\r
- {\r
- Assert.Pass("Test skipped! Can't test due to not supported exception");\r
+ if (support)
+ {
+ try
+ {
+ object powerUsage = PowerUsage.GetPowerUsage(appID, PowerUsageResourceType.Cpu, startTime, endTime);
+ Assert.IsTrue(powerUsage is double, "GetPowerUsage() should return power usage value in double for the specific resource for the given application in custom interval");
+ Assert.IsTrue((double)powerUsage >= 0, "GetPowerUsage() should return usage value for the specific resource for the given application in custom interval");
+ }
+ catch (ArgumentException)
+ {
+ Assert.Pass("No data record corresponding to given resource type and appID");
+ }
+ catch (Exception e)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, e.ToString());
+ Assert.IsTrue(false, e.ToString());
+ }
+ }
+ else
+ {
+ Assert.Pass("Test skipped! Can't test due to not supported exception");
}
}
[Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, Tizen.System.PowerUsageResourceType, DateTime, DateTime")]
[Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
- public void GetPowerUsageByAppPerResource_CHECK_NOT_SUPPORTED_EXCEPTION()
- {\r
+ public void GetPowerUsage_CHECK_NOT_SUPPORTED_EXCEPTION_BY_APP_PER_RESOURCE()
+ {
if (support)
{
Assert.Pass("Test skipped! Can't test not supported exception");
}
else
- {\r
- try\r
- {\r
- object powerUsage = PowerUsage.GetPowerUsage(appID, PowerUsageResourceType.Cpu, startTime, endTime);\r
- Assert.IsTrue(false, "This operation should raise NotSupportedException");\r
- }\r
- catch (Exception ex)\r
- {\r
- Assert.IsTrue(ex.GetType() == typeof(NotSupportedException), "This operation should raise NotSupportedException");\r
- }\r
- }\r
+ {
+ try
+ {
+ object powerUsage = PowerUsage.GetPowerUsage(appID, PowerUsageResourceType.Cpu, startTime, endTime);
+ Assert.IsTrue(false, "This operation should raise NotSupportedException");
+ }
+ catch (Exception ex)
+ {
+ Assert.IsTrue(ex.GetType() == typeof(NotSupportedException), "This operation should raise NotSupportedException");
+ }
+ }
}
[Test]
[Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, Tizen.System.PowerUsageResourceType, DateTime, DateTime")]
[Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
- public void GetPowerUsageByAppPerResource_CHECK_ARGUMENT_EXCEPTION()
- {\r
+ public void GetPowerUsage_CHECK_ARGUMENT_EXCEPTION_BY_APP_PER_RESOURCE()
+ {
if (support)
{
- try\r
- {\r
- object powerUsage = PowerUsage.GetPowerUsage(appID, PowerUsageResourceType.Cpu, DateTime.Now.AddDays(1), DateTime.Now.AddDays(2));\r
- Assert.IsTrue(false, "This operation should raise ArgumentException");\r
+ try
+ {
+ object powerUsage = PowerUsage.GetPowerUsage(appID, PowerUsageResourceType.Cpu, DateTime.Now.AddDays(-1), DateTime.Now.AddDays(-2));
+ Assert.IsTrue(false, "This operation should raise ArgumentException");
}
- catch (Exception ex)\r
- {\r
- Assert.IsTrue(ex.GetType() == typeof(ArgumentException), "this operation should raise ArgumentException exception");\r
+ catch (Exception ex)
+ {
+ Assert.IsTrue(ex.GetType() == typeof(ArgumentException), "this operation should raise ArgumentException exception");
}
}
else
- {\r
- Assert.Pass("Test skipped! Can't test due to not supported exception");\r
- }\r
+ {
+ Assert.Pass("Test skipped! Can't test due to not supported exception");
+ }
}
[Test]
[Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, Tizen.System.PowerUsageResourceType, DateTime, DateTime")]
[Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
- public void GetPowerUsageByAppPerResource_CHECK_INVALID_OPERATION_EXCEPTION()\r
- {\r
- if (support)\r
- {\r
- try\r
- {\r
- object powerUsage = PowerUsage.GetPowerUsage(appID, PowerUsageResourceType.Cpu, startTime, endTime);\r
- Assert.Pass("Test skipped! since no system error occured to test Invalid operation");\r
- }\r
- catch (Exception ex)\r
- {\r
- Assert.IsTrue(ex.GetType() == typeof(InvalidOperationException), "This operation will raise InvalidOperationException incase of any system error");\r
- }\r
- }\r
- else\r
- {\r
- Assert.Pass("Test skipped! Can't test due to not supported exception");\r
- }\r
+ public void GetPowerUsage_CHECK_INVALID_OPERATION_EXCEPTION_BY_APP_PER_RESOURCE()
+ {
+ if (support)
+ {
+ try
+ {
+ object powerUsage = PowerUsage.GetPowerUsage(appID, PowerUsageResourceType.Cpu, startTime, endTime);
+ }
+ catch (ArgumentException)
+ {
+ Assert.Pass("No data record corresponding to given resource type and appID");
+ return;
+ }
+ catch (Exception ex)
+ {
+ Assert.IsTrue(ex.GetType() == typeof(InvalidOperationException), "This operation will raise InvalidOperationException incase of any system error");
+ return;
+ }
+ Assert.Pass("Test skipped! since no system error occured to test Invalid operation");
+ }
+ else
+ {
+ Assert.Pass("Test skipped! Can't test due to not supported exception");
+ }
}
[Test]
[Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MR")]
+ [Property("COVPARAM", "string, DateTime, DateTime")]
[Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
- public void GetPowerUsageByApp_CHECK_RESULT()
+ public void GetPowerUsage_CHECK_RESULT_BY_APP()
{
- if (support)\r
- {\r
- try\r
- {\r
- object powerUsage = PowerUsage.GetPowerUsage(appID, startTime, endTime);\r
- Assert.IsTrue(powerUsage is double, "GetPowerUsage() should return power usage value corresponding to app in double");\r
- Assert.IsTrue((double)powerUsage >= 0, "GetPowerUsage() should return usage value corresponding to app");\r
- }\r
- catch (Exception e)\r
- {\r
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, e.ToString());\r
- Assert.IsTrue(false, e.ToString());\r
- }\r
+ if (support)
+ {
+ try
+ {
+ object powerUsage = PowerUsage.GetPowerUsage(appID, startTime, endTime);
+ Assert.IsTrue(powerUsage is double, "GetPowerUsage() should return power usage value corresponding to app in double");
+ Assert.IsTrue((double)powerUsage >= 0, "GetPowerUsage() should return usage value corresponding to app");
+ }
+ catch (InvalidOperationException)
+ {
+ Assert.Pass("No data record corresponding to given appID");
+ }
+ catch (Exception e)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, e.ToString());
+ Assert.IsTrue(false, e.ToString());
+ }
}
- else\r
- {\r
- Assert.Pass("Test skipped! Can't test due to not supported exception");\r
+ else
+ {
+ Assert.Pass("Test skipped! Can't test due to not supported exception");
}
- }\r
-\r
+ }
+
[Test]
[Category("P2")]
[Description("Check if GetPowerUsage() raises not supported exception")]
[Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, DateTime, DateTime")]
[Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
- public void GetPowerUsageByApp_CHECK_NOT_SUPPORTED_EXCEPTION()
- {\r
+ public void GetPowerUsage_CHECK_NOT_SUPPORTED_EXCEPTION_BY_APP()
+ {
if (support)
{
Assert.Pass("Test skipped! Can't test not supported exception");
}
else
- {\r
- try\r
- {\r
- object powerUsage = PowerUsage.GetPowerUsage(appID, startTime, endTime);\r
- Assert.IsTrue(false, "This operation should raise NotSupportedException");\r
- }\r
- catch (Exception ex)\r
- {\r
- Assert.IsTrue(ex.GetType() == typeof(NotSupportedException), "This operation should raise NotSupportedException");\r
- }\r
- }\r
+ {
+ try
+ {
+ object powerUsage = PowerUsage.GetPowerUsage(appID, startTime, endTime);
+ Assert.IsTrue(false, "This operation should raise NotSupportedException");
+ }
+ catch (Exception ex)
+ {
+ Assert.IsTrue(ex.GetType() == typeof(NotSupportedException), "This operation should raise NotSupportedException");
+ }
+ }
}
[Test]
[Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, DateTime, DateTime")]
[Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
- public void GetPowerUsageByApp_CHECK_ARGUMENT_EXCEPTION()
- {\r
+ public void GetPowerUsage_CHECK_ARGUMENT_EXCEPTION_BY_APP()
+ {
if (support)
{
- try\r
- {\r
- object powerUsage = PowerUsage.GetPowerUsage(appID, DateTime.Now.AddDays(1), DateTime.Now.AddDays(2));\r
- Assert.IsTrue(false, "This operation should raise ArgumentException");\r
+ try
+ {
+ object powerUsage = PowerUsage.GetPowerUsage(appID, DateTime.Now.AddDays(-1), DateTime.Now.AddDays(-2));
+ Assert.IsTrue(false, "This operation should raise ArgumentException");
}
- catch (Exception ex)\r
- {\r
- Assert.IsTrue(ex.GetType() == typeof(ArgumentException), "this operation should raise ArgumentException exception");\r
+ catch (Exception ex)
+ {
+ Assert.IsTrue(ex.GetType() == typeof(ArgumentException), "this operation should raise ArgumentException exception");
}
}
else
- {\r
- Assert.Pass("Test skipped! Can't test due to not supported exception");\r
- }\r
+ {
+ Assert.Pass("Test skipped! Can't test due to not supported exception");
+ }
}
[Test]
[Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "string, DateTime, DateTime")]
[Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
- public void GetPowerUsageByApp_CHECK_INVALID_OPERATION_EXCEPTION()\r
- {\r
- if (support)\r
- {\r
- try\r
- {\r
- object powerUsage = PowerUsage.GetPowerUsage(appID, startTime, endTime);\r
- Assert.Pass("Test skipped! since no system error occured to test Invalid operation");\r
- }\r
- catch (Exception ex)\r
- {\r
- Assert.IsTrue(ex.GetType() == typeof(InvalidOperationException), "This operation will raise InvalidOperationException incase of any system error");\r
- }\r
- }\r
- else\r
- {\r
- Assert.Pass("Test skipped! Can't test due to not supported exception");\r
- }\r
+ public void GetPowerUsage_CHECK_INVALID_OPERATION_EXCEPTION_BY_APP()
+ {
+ if (support)
+ {
+ try
+ {
+ object powerUsage = PowerUsage.GetPowerUsage(appID, startTime, endTime);
+ }
+ catch (Exception ex)
+ {
+ Assert.IsTrue(ex.GetType() == typeof(InvalidOperationException), "This operation will raise InvalidOperationException incase of any system error");
+ return;
+ }
+ Assert.Pass("Test skipped! since no system error occured to test Invalid operation");
+ }
+ else
+ {
+ Assert.Pass("Test skipped! Can't test due to not supported exception");
+ }
}
[Test]
[Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MR")]
+ [Property("COVPARAM", "Tizen.System.PowerUsageResourceType, DateTime, DateTime")]
[Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
- public void GetPowerUsageByResource_CHECK_RESULT()
+ public void GetPowerUsage_CHECK_RESULT_BY_RESOURCE()
{
- if (support)\r
- {\r
- try\r
- {\r
- object powerUsage = PowerUsage.GetPowerUsage(PowerUsageResourceType.Cpu, startTime, endTime);\r
- Assert.IsTrue(powerUsage is double, "GetPowerUsage() should return power usage value in double by a resource for certain time interval");\r
- Assert.IsTrue((double)powerUsage >= 0, "GetPowerUsage() should return usage value by a resource for certain time interval");\r
- }\r
- catch (Exception e)\r
- {\r
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, e.ToString());\r
- Assert.IsTrue(false, e.ToString());\r
- }\r
+ if (support)
+ {
+ try
+ {
+ object powerUsage = PowerUsage.GetPowerUsage(PowerUsageResourceType.Cpu, startTime, endTime);
+ Assert.IsTrue(powerUsage is double, "GetPowerUsage() should return power usage value in double by a resource for certain time interval");
+ Assert.IsTrue((double)powerUsage >= 0, "GetPowerUsage() should return usage value by a resource for certain time interval");
+ }
+ catch (Exception e)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, e.ToString());
+ Assert.IsTrue(false, e.ToString());
+ }
}
- else\r
- {\r
- Assert.Pass("Test skipped! Can't test due to not supported exception");\r
+ else
+ {
+ Assert.Pass("Test skipped! Can't test due to not supported exception");
}
}
[Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "Tizen.System.PowerUsageResourceType, DateTime, DateTime")]
[Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
- public void GetPowerUsageByResource_CHECK_NOT_SUPPORTED_EXCEPTION()
- {\r
+ public void GetPowerUsage_CHECK_NOT_SUPPORTED_EXCEPTION_BY_RESOURCE()
+ {
if (support)
{
Assert.Pass("Test skipped! Can't test not supported exception");
}
else
- {\r
- try\r
- {\r
- object powerUsage = PowerUsage.GetPowerUsage(PowerUsageResourceType.Cpu, startTime, endTime);\r
- Assert.IsTrue(false, "This operation should raise NotSupportedException");\r
- }\r
- catch (Exception ex)\r
- {\r
- Assert.IsTrue(ex.GetType() == typeof(NotSupportedException), "This operation should raise NotSupportedException");\r
- }\r
- }\r
+ {
+ try
+ {
+ object powerUsage = PowerUsage.GetPowerUsage(PowerUsageResourceType.Cpu, startTime, endTime);
+ Assert.IsTrue(false, "This operation should raise NotSupportedException");
+ }
+ catch (Exception ex)
+ {
+ Assert.IsTrue(ex.GetType() == typeof(NotSupportedException), "This operation should raise NotSupportedException");
+ }
+ }
}
[Test]
[Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "Tizen.System.PowerUsageResourceType, DateTime, DateTime")]
[Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
- public void GetPowerUsageByResource_CHECK_ARGUMENT_EXCEPTION()
- {\r
+ public void GetPowerUsage_CHECK_ARGUMENT_EXCEPTION_BY_RESOURCE()
+ {
if (support)
{
- try\r
- {\r
- object powerUsage = PowerUsage.GetPowerUsage(PowerUsageResourceType.Cpu, DateTime.Now.AddDays(1), DateTime.Now.AddDays(2));\r
- Assert.IsTrue(false, "This operation should raise ArgumentException");\r
+ try
+ {
+ object powerUsage = PowerUsage.GetPowerUsage(PowerUsageResourceType.Cpu, DateTime.Now.AddDays(-1), DateTime.Now.AddDays(-2));
+ Assert.IsTrue(false, "This operation should raise ArgumentException");
}
- catch (Exception ex)\r
- {\r
- Assert.IsTrue(ex.GetType() == typeof(ArgumentException), "this operation should raise ArgumentException exception");\r
+ catch (Exception ex)
+ {
+ Assert.IsTrue(ex.GetType() == typeof(ArgumentException), "this operation should raise ArgumentException exception");
}
}
else
- {\r
- Assert.Pass("Test skipped! Can't test due to not supported exception");\r
- }\r
+ {
+ Assert.Pass("Test skipped! Can't test due to not supported exception");
+ }
}
[Test]
[Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MEX")]
+ [Property("COVPARAM", "Tizen.System.PowerUsageResourceType, DateTime, DateTime")]
[Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
- public void GetPowerUsageByResource_CHECK_INVALID_OPERATION_EXCEPTION()\r
- {\r
- if (support)\r
- {\r
- try\r
- {\r
- object powerUsage = PowerUsage.GetPowerUsage(PowerUsageResourceType.Cpu, startTime, endTime);\r
- Assert.Pass("Test skipped! since no system error occured to test Invalid operation");\r
- }\r
- catch (Exception ex)\r
- {\r
- Assert.IsTrue(ex.GetType() == typeof(InvalidOperationException), "This operation will raise InvalidOperationException incase of any system error");\r
- }\r
- }\r
- else\r
- {\r
- Assert.Pass("Test skipped! Can't test due to not supported exception");\r
- }\r
+ public void GetPowerUsage_CHECK_INVALID_OPERATION_EXCEPTION_BY_RESOURCE()
+ {
+ if (support)
+ {
+ try
+ {
+ object powerUsage = PowerUsage.GetPowerUsage(PowerUsageResourceType.Cpu, startTime, endTime);
+ }
+ catch (Exception ex)
+ {
+ Assert.IsTrue(ex.GetType() == typeof(InvalidOperationException), "This operation will raise InvalidOperationException incase of any system error");
+ return;
+ }
+ Assert.Pass("Test skipped! since no system error occured to test Invalid operation");
+ }
+ else
+ {
+ Assert.Pass("Test skipped! Can't test due to not supported exception");
+ }
}
}
-}
+}
\ No newline at end of file