public void Should_Error_if_ConfigurationStore_is_Null() { ValidateLaunch canLaunch; IConfigurationStore configurationStore = null; IVMData hyperV = new StubIVMData(); ConfigurationException ex = Assert.Throws<ConfigurationErrorsException>(() => canLaunch = new ValidateLaunch(configurationStore,hyperV)); Assert.Equal("Missing Configuration Store", ex.Message); }
public void Should_Error_if_ConfigurationStore_is_Null() { ValidateLaunch canLaunch; IConfigurationStore configurationStore = null; IVMData hyperV = new StubIVMData(); ConfigurationException ex = Assert.Throws <ConfigurationErrorsException>(() => canLaunch = new ValidateLaunch(configurationStore, hyperV)); Assert.Equal("Missing Configuration Store", ex.Message); }
public void Should_Error_if_Missing_Max_VM_Running_Setting() { string expectedMessage = "Missing Configuration Setting: MAX_NUMBER_OF_VMs_RUNNING"; string oldConfig = RemoveConfigNode(configPath, "MAX_NUMBER_OF_VMs_RUNNING"); DefaultConfigurationStore store = DefaultConfigurationStore.Current; IVMData hyperV = new StubIVMData() { GetNumberOfRunningVMsStringStringString = (string a, string b, string c) => { return(2); } }; ValidateLaunch canLaunch = new ValidateLaunch(store, hyperV); ConfigurationException ex = Assert.Throws <ConfigurationErrorsException>(() => canLaunch.VerifyLaunchConditions()); RestoreConfiguration(configPath, oldConfig); Assert.Equal(expectedMessage, ex.Message); }
public void Should_Error_if_Non_Int_Max_VM_Running_Setting() { string expectedMessage = "Bad Configuration Setting: MAX_NUMBER_OF_VMs_RUNNING"; string oldConfig = UpdateConfigValue(configPath,"MAX_NUMBER_OF_VMs_RUNNING", "NOT_AN_INT"); DefaultConfigurationStore store = DefaultConfigurationStore.Current; IVMData hyperV = new StubIVMData() { GetNumberOfRunningVMsStringStringString = (string a, string b, string c) => { return 2; } }; ValidateLaunch canLaunch = new ValidateLaunch(store,hyperV); ConfigurationException ex = Assert.Throws<ConfigurationErrorsException>(() => canLaunch.VerifyLaunchConditions()); RestoreConfiguration(configPath, oldConfig); Assert.Equal(expectedMessage, ex.Message); }