コード例 #1
0
        public void CopyKeyValuesWithDuplicateKeyThrowException()
        {
            // Arrange
            var source = new NameValueCollection { { "key1", "value1" } };
            var dest = new NameValueCollection { { "key1", "value1" } };

            // Act
            // Assert
            Assert.Throws<ApplicationException>(() => source.CopyKeyValues(dest));
        }
コード例 #2
0
        public void UnableToCopyKeyValues()
        {
            // Arrange
            var source = new NameValueCollection { { "key1", "value1" }, { "key2", "value2" }, };
            var dest = new NameValueCollection();

            // Act
            source.CopyKeyValues(dest);

            // Assert
            Assert.IsTrue(dest["key1"] == "value1");
            Assert.IsTrue(dest["key2"] == "value2");
        }