2 using System.Threading.Tasks;
6 namespace SystemSettingsUnitTest
9 //[Description("Tizen.System.EmailAlertRingtoneChangedEventArgs Tests")]
10 public static class EmailAlertRingtoneChangedEventArgsTests
12 private static bool s_emailAlertRingtoneCallbackCalled = false;
13 private static readonly string s_emailAlertRingtoneValue = SystemSettingsTestInput.GetStringValue((int)Tizen.System.SystemSettingsKeys.EmailAlertRingtone);
16 //[Description("Check EmailAlertRingtoneChangedEventArgs Value property")]
17 //[Property("SPEC", "Tizen.System.EmailAlertRingtoneChangedEventArgs.Value A")]
18 //[Property("SPEC_URL", "-")]
19 //[Property("CRITERIA", "PRO")]
20 //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")]
21 public static async Task Value_PROPERTY_READ_ONLY()
28 * 1. Assign event handler
30 Tizen.System.SystemSettings.EmailAlertRingtoneChanged += OnEmailAlertRingtoneChangedValue;
32 string preValue = Tizen.System.SystemSettings.EmailAlertRingtone;
33 Tizen.System.SystemSettings.EmailAlertRingtone = s_emailAlertRingtoneValue;
34 await Task.Delay(2000);
35 Assert.IsTrue(s_emailAlertRingtoneCallbackCalled, "Value_PROPERTY_READ_ONLY: EventHandler added. Not getting called");
39 * 1. Reset callback called flag
40 * 2. Remove event handler
41 * 3. Reset property value
43 s_emailAlertRingtoneCallbackCalled = false;
44 Tizen.System.SystemSettings.EmailAlertRingtoneChanged -= OnEmailAlertRingtoneChangedValue;
45 Tizen.System.SystemSettings.EmailAlertRingtone = preValue;
48 catch (NotSupportedException)
50 bool isSupport = true;
51 Information.TryGetValue<bool>("tizen.org/feature/systemsetting.notification_email", out isSupport);
52 Assert.IsTrue(isSupport == false, "Invalid NotSupportedException");
53 Tizen.Log.Debug("CS-SYSTEM-SETTINGS", ">>>>>> NotSupport(tizen.org/feature/systemsetting.notification_email)");
54 LogUtils.NotSupport();
57 private static void OnEmailAlertRingtoneChangedValue(object sender, Tizen.System.EmailAlertRingtoneChangedEventArgs e)
59 s_emailAlertRingtoneCallbackCalled = true;
61 Assert.IsInstanceOf<string>(e.Value, "OnEmailAlertRingtoneChangedValue: EmailAlertRingtone not an instance of string");
62 Assert.IsTrue(s_emailAlertRingtoneValue.CompareTo(e.Value) == 0, "OnEmailAlertRingtoneChanged: The callback should receive the latest value for the property.");