Map() public static method

public static Map ( NameValueCollection source ) : NameValueCollection
source System.Collections.Specialized.NameValueCollection
return System.Collections.Specialized.NameValueCollection
            public void ReturnsNullIfSourceValueIsNull()
            {
                var rc = new ResolutionContext(null, null, new NameValueCollection(), typeof(NameValueCollection), typeof(NameValueCollection), null, Mapper.Engine);
                var nvcm = new NameValueCollectionMapper();

                var result = nvcm.Map(rc, null);

                result.ShouldBeNull();
            }
            public void ReturnsEmptyCollectionWhenSourceCollectionIsEmpty()
            {
                var sourceValue = new NameValueCollection();
                var rc = new ResolutionContext(null, sourceValue, new NameValueCollection(), typeof(NameValueCollection), typeof(NameValueCollection), null, Mapper.Engine);
                var nvcm = new NameValueCollectionMapper();

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

                result.ShouldBeEmpty();
            }
            public void ReturnsNullIfSourceValueIsNull()
            {
                var config = new MapperConfiguration(_ => { });
                var mapper = new Mapper(config);
                var rc = new ResolutionContext(null, new NameValueCollection(), new TypePair(typeof(NameValueCollection), typeof(NameValueCollection)), new MappingOperationOptions(config.ServiceCtor), mapper);
                var nvcm = new NameValueCollectionMapper();

                var result = nvcm.Map(rc);

                result.ShouldBeNull();
            }
            public void ReturnsEmptyCollectionWhenSourceCollectionIsEmpty()
            {
                var config = new MapperConfiguration(_ => { });
                var mapper = new Mapper(config);
                var sourceValue = new NameValueCollection();
                var rc = new ResolutionContext(sourceValue, null, new TypePair(typeof(NameValueCollection), typeof(NameValueCollection)), new MappingOperationOptions(config.ServiceCtor), mapper);
                var nvcm = new NameValueCollectionMapper();

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

                result.ShouldBeEmpty(); 
            }
            public void ReturnsMappedObjectWithExpectedValuesWhenSourceCollectionHasOneItem()
            {
                var sourceValue = new NameValueCollection() { { "foo", "bar" } };
                var rc = new ResolutionContext(null, sourceValue, new NameValueCollection(), typeof(NameValueCollection), typeof(NameValueCollection), null, Mapper.Engine);

                var nvcm = new NameValueCollectionMapper();

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

                1.ShouldEqual(result.Count);
                "foo".ShouldEqual(result.AllKeys[0]);
                "bar".ShouldEqual(result["foo"]);
            }
            public void ReturnsMappedObjectWithExpectedValuesWhenSourceCollectionHasOneItem()
            {
                var config = new MapperConfiguration(_ => { });
                var mapper = new Mapper(config);
                var sourceValue = new NameValueCollection() { { "foo", "bar" } };
                var rc = new ResolutionContext(sourceValue, new NameValueCollection(), new TypePair(typeof(NameValueCollection), typeof(NameValueCollection)), new MappingOperationOptions(config.ServiceCtor), mapper);

                var nvcm = new NameValueCollectionMapper();

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

                1.ShouldEqual(result.Count);
                "foo".ShouldEqual(result.AllKeys[0]);
                "bar".ShouldEqual(result["foo"]);
            }
            public void ReturnsNullIfSourceTypeIsNotNameValueCollection()
            {
                var rc = new ResolutionContext(null, new Object(), new NameValueCollection(), typeof(Object), typeof(NameValueCollection), null);
                var nvcm = new NameValueCollectionMapper();

                var result = nvcm.Map(rc, null);

                Assert.IsNull(result);
            }