コード例 #1
0
        public void Copy()
        {
            // Arrange
            var collection = new System.Collections.Specialized.NameValueCollection
            {
                { "A", "1" },
                { "B", "2" },
                { "C", "3" }
            };

            // Act
            var copiedCollection = collection.Copy();

            // Assert
            Assert.AreEqual(3, copiedCollection.Count);
            Assert.AreEqual("1", copiedCollection[0]);
            Assert.AreEqual("2", copiedCollection[1]);
            Assert.AreEqual("3", copiedCollection[2]);
            Assert.AreEqual("A", copiedCollection.Keys[0]);
            Assert.AreEqual("B", copiedCollection.Keys[1]);
            Assert.AreEqual("C", copiedCollection.Keys[2]);
        }