public void It_should_reject_null_user_names() { typeof(ArgumentNullException).ShouldBeThrownBy( () => DisposableHelp.SafeCreate(() => new ClusterCredentials(validUri, null, validPassword))); typeof(ArgumentNullException).ShouldBeThrownBy( () => DisposableHelp.SafeCreate(() => new ClusterCredentials(validUri, null, securePassword))); }
public void It_should_throw_when_the_list_is_too_short() { var lst = new List <string>(); // empty var ae = (ArgumentException) typeof(ArgumentException).ShouldBeThrownBy(() => DisposableHelp.SafeCreate(() => ClusterCredentialsFactory.CreateFromList(lst))); ae.ParamName.ShouldEqual("lines"); // one lst.Add(Guid.NewGuid().ToString()); ae = (ArgumentException) typeof(ArgumentException).ShouldBeThrownBy(() => DisposableHelp.SafeCreate(() => ClusterCredentialsFactory.CreateFromList(lst))); ae.ParamName.ShouldEqual("lines"); // two lst.Add(Guid.NewGuid().ToString()); ae = (ArgumentException) typeof(ArgumentException).ShouldBeThrownBy(() => DisposableHelp.SafeCreate(() => ClusterCredentialsFactory.CreateFromList(lst))); ae.ParamName.ShouldEqual("lines"); }
public void It_should_reject_empty_user_names() { typeof(ArgumentEmptyException).ShouldBeThrownBy( () => DisposableHelp.SafeCreate(() => new ClusterCredentials(validUri, string.Empty, validPassword))); typeof(ArgumentEmptyException).ShouldBeThrownBy( () => DisposableHelp.SafeCreate(() => new ClusterCredentials(validUri, string.Empty, securePassword))); }
public void It_should_reject_null_passwords() { typeof(ArgumentNullException).ShouldBeThrownBy( () => DisposableHelp.SafeCreate(() => new ClusterCredentials(validUri, validUserName, (string)null))); typeof(ArgumentNullException).ShouldBeThrownBy( () => DisposableHelp.SafeCreate(() => new ClusterCredentials(validUri, validUserName, (SecureString)null))); }
public void It_should_throw_when_the_list_is_null() { var ane = (ArgumentNullException) typeof(ArgumentNullException).ShouldBeThrownBy(() => DisposableHelp.SafeCreate(() => ClusterCredentialsFactory.CreateFromList(null))); ane.ParamName.ShouldEqual("lines"); }
public void It_should_throw_the_file_does_not_exist() { string path = Path.Combine(Directory.GetCurrentDirectory(), Guid.NewGuid().ToString()); var fnfe = (FileNotFoundException) typeof(FileNotFoundException).ShouldBeThrownBy(() => DisposableHelp.SafeCreate(() => ClusterCredentialsFactory.CreateFromFile(path))); fnfe.FileName.ShouldEqual(path); }
public void It_should_throw_when_I_get_the_password() { typeof(ObjectDisposedException).ShouldBeThrownBy(() => DisposableHelp.SafeCreate(() => target.ClusterPassword)); }