public void DeletePlanIfExist_Given_ValidPlanId_Deletes_Plan()
        {
            var planId = PowerManager.DuplicatePlan(_balancedPlanGuid, _nonExistentPlanGuid1);

            PowerManager.DeletePlanIfExists(planId);
            var stillExists = PowerManager.PlanExists(planId);

            Assert.IsFalse(stillExists);
        }
 public void DuplicatePlan_Given_TargetId_Creates_NewPlan()
 {
     try
     {
         var res = PowerManager.DuplicatePlan(_balancedPlanGuid, _nonExistentPlanGuid1);
         Assert.AreEqual(_nonExistentPlanGuid1, res);
     }
     finally
     {
         PowerManager.DeletePlan(_nonExistentPlanGuid1);
     }
 }
        public void SetPlanSetting_Given_ConflictingGroupAndSetting_Throws_Win32Exception()
        {
            var planId = PowerManager.DuplicatePlan(_balancedPlanGuid, _nonExistentPlanGuid1);

            try
            {
                PowerManager.SetPlanSetting(planId, SettingSubgroup.BATTERY_SUBGROUP, Setting.LIDACTION, PowerMode.AC, 0);
            }
            finally
            {
                PowerManager.DeletePlan(planId);
            }
        }
        public void DuplicatePlan_Given_NoTargetId_Creates_NewPlan()
        {
            var res = PowerManager.DuplicatePlan(_balancedPlanGuid);

            try
            {
                Assert.IsNotNull(res);
                Assert.AreNotEqual(Guid.Empty, res);
            }
            finally
            {
                PowerManager.DeletePlan(res);
            }
        }
        public void SetPlanDescription_Sets_PlanDescription()
        {
            var planId = PowerManager.DuplicatePlan(_balancedPlanGuid, _nonExistentPlanGuid1);

            try
            {
                var expectedDescription = "Description";

                PowerManager.SetPlanDescription(planId, expectedDescription);
                var actualDescription = PowerManager.GetPlanDescription(planId);

                Assert.AreEqual(expectedDescription, actualDescription);
            }
            finally
            {
                PowerManager.DeletePlan(planId);
            }
        }
        public void SetPlanName_Sets_PlanName()
        {
            var planId = PowerManager.DuplicatePlan(_balancedPlanGuid, _nonExistentPlanGuid1);

            try
            {
                var expectedName = "Name";

                PowerManager.SetPlanName(planId, expectedName);
                var actualName = PowerManager.GetPlanName(planId);

                Assert.AreEqual(expectedName, actualName);
            }
            finally
            {
                PowerManager.DeletePlan(planId);
            }
        }
        public void SetActivePlan_Sets_ActivePlan()
        {
            var sourcePlan = PowerManager.GetActivePlan();

            Assert.IsNotNull(sourcePlan);
            Assert.AreNotEqual(Guid.Empty, sourcePlan);
            try
            {
                PowerManager.DuplicatePlan(_balancedPlanGuid, _nonExistentPlanGuid1);
                PowerManager.SetActivePlan(_nonExistentPlanGuid1);

                var active = PowerManager.GetActivePlan();
                Assert.AreEqual(_nonExistentPlanGuid1, active);
            }
            finally
            {
                PowerManager.SetActivePlan(sourcePlan);
                PowerManager.DeletePlan(_nonExistentPlanGuid1);
            }
        }
        public void SetPlanSetting_Sets_Setting()
        {
            var planId = PowerManager.DuplicatePlan(_balancedPlanGuid, _nonExistentPlanGuid1);

            try
            {
                var subgroup = SettingSubgroup.SYSTEM_BUTTON_SUBGROUP;
                var setting  = Setting.PBUTTONACTION;


                uint expectedValue = 0;

                PowerManager.SetPlanSetting(planId, subgroup, setting, PowerMode.AC, expectedValue);

                var actualValue = PowerManager.GetPlanSetting(planId, subgroup, setting, PowerMode.AC);

                Assert.AreEqual(expectedValue, actualValue);
            }
            finally
            {
                PowerManager.DeletePlan(planId);
            }
        }
 public void DuplicatePlan_Given_PreexistingTargetPlan_ThrowsWin32Exception()
 {
     PowerManager.DuplicatePlan(_balancedPlanGuid, _balancedPlanGuid);
 }
Ejemplo n.º 10
0
 public void DuplicatePlan_Given_NonExistentSourcePlan_Throws_Win32Exception()
 {
     PowerManager.DuplicatePlan(_nonExistentPlanGuid1);
 }