コード例 #1
0
        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");
        }
コード例 #2
0
        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");
        }