コード例 #1
0
            public void ReturnsEmptyCollectionWhenSourceCollectionIsEmpty()
            {
                var sourceValue = new NameValueCollection();
                var rc = new ResolutionContext(null, sourceValue, new NameValueCollection(),
                    typeof (NameValueCollection), typeof (NameValueCollection), null, Mapper.Context);
                var nvcm = new NameValueCollectionMapper();

                var result = nvcm.Map(rc) as NameValueCollection;

                result.ShouldBeEmpty();
            }
コード例 #2
0
            public void ReturnsMappedObjectWithExpectedValuesWhenSourceCollectionHasOneItem()
            {
                var sourceValue = new NameValueCollection() {{"foo", "bar"}};
                var rc = new ResolutionContext(null, sourceValue, new NameValueCollection(),
                    typeof (NameValueCollection), typeof (NameValueCollection), null, Mapper.Context);

                var nvcm = new NameValueCollectionMapper();

                var result = nvcm.Map(rc) as NameValueCollection;

                1.ShouldEqual(result.Count);
                "foo".ShouldEqual(result.AllKeys[0]);
                "bar".ShouldEqual(result["foo"]);
            }
コード例 #3
0
            public void ReturnsNullIfSourceTypeIsNotNameValueCollection()
            {
                var rc = new ResolutionContext(null, new object(), new NameValueCollection(), typeof (object),
                    typeof (NameValueCollection), null, Mapper.Context);
                var nvcm = new NameValueCollectionMapper();

                var result = nvcm.Map(rc);

                result.ShouldBeNull();
            }