1 using System.Threading.Tasks;
4 namespace SystemSettingsUnitTest
7 //[Description("Tizen.System.SoundNotificationRepetitionPeriodChangedEventArgs Tests")]
8 public static class SoundNotificationRepetitionPeriodChangedEventArgsTests
10 private static bool s_soundNotificationRepetitionPeriodCallbackCalled = false;
11 private static readonly int s_soundNotificationRepetitionPeriodValue = 300;
14 //[Description("Check SoundNotificationRepetitionPeriodChangedEventArgs Value property")]
15 //[Property("SPEC", "Tizen.System.SoundNotificationRepetitionPeriodChangedEventArgs.Value A")]
16 //[Property("SPEC_URL", "-")]
17 //[Property("CRITERIA", "PRO")]
18 //[Property("AUTHOR", "Aditya Aswani, a.aswani@samsung.com")]
19 public static async Task Value_PROPERTY_READ_ONLY()
24 * 1. Assign event handler
26 Tizen.System.SystemSettings.SoundNotificationRepetitionPeriodChanged += OnSoundNotificationRepetitionPeriodChangedValue;
28 int preValue = Tizen.System.SystemSettings.SoundNotificationRepetitionPeriod;
29 Tizen.System.SystemSettings.SoundNotificationRepetitionPeriod = s_soundNotificationRepetitionPeriodValue;
30 await Task.Delay(2000);
31 Assert.IsTrue(s_soundNotificationRepetitionPeriodCallbackCalled, "Value_PROPERTY_READ_ONLY: EventHandler added. Not getting called");
35 * 1. Reset callback called flag
36 * 2. Remove event handler
37 * 3. Reset property value
39 s_soundNotificationRepetitionPeriodCallbackCalled = false;
40 Tizen.System.SystemSettings.SoundNotificationRepetitionPeriodChanged -= OnSoundNotificationRepetitionPeriodChangedValue;
41 Tizen.System.SystemSettings.SoundNotificationRepetitionPeriod = preValue;
44 private static void OnSoundNotificationRepetitionPeriodChangedValue(object sender, Tizen.System.SoundNotificationRepetitionPeriodChangedEventArgs e)
46 s_soundNotificationRepetitionPeriodCallbackCalled = true;
48 Assert.IsInstanceOf<int>(e.Value, "OnSoundNotificationRepetitionPeriodChangedValue: EventHandler added. Not getting called");
49 Assert.IsTrue(s_soundNotificationRepetitionPeriodValue.CompareTo(e.Value) == 0, "OnSoundNotificationRepetitionPeriodChangedValue: The callback should receive the latest value for the property.");