예제 #1
0
        public void IsSet()
        {
            DataValueCollection <string> collection = new DataValueCollection <string>();

            collection.Set("Name", "Bob");
            collection.Set("Age", 25);

            Assert.IsTrue(collection.IsSet("Name"));
            Assert.IsTrue(collection.IsSet("Age"));
        }
예제 #2
0
        public void SetMultiple()
        {
            DataValueCollection <string> collection = new DataValueCollection <string>();

            collection.Set("Name", "Bob");
            collection.Set("Age", 25);

            Assert.AreEqual("Bob", collection.RetrieveString("Name"));
            Assert.AreEqual(25, collection.RetrieveInt32("Age"));
        }
예제 #3
0
        public void Count()
        {
            DataValueCollection <string> collection = new DataValueCollection <string>();

            collection.Set("Name", "Bob");
            collection.Set("Age", 25);

            Assert.AreEqual(2, collection.Count);

            collection.Remove("Name");

            Assert.AreEqual(1, collection.Count);
        }
예제 #4
0
        public void SetAndRetrieve()
        {
            DataValueCollection <string> collection = new DataValueCollection <string>();

            collection.Set("Name", "Bob");

            Assert.AreEqual("Bob", collection.RetrieveString("Name"));
        }
예제 #5
0
        public void RetrieveDateAsStringAndDateTime()
        {
            DataValueCollection <string> collection = new DataValueCollection <string>();

            collection.Set("Date", "12/12/2014");

            Assert.AreEqual("12/12/2014", collection.RetrieveString("Date"));
            Assert.AreEqual(DateTime.Parse("12/12/2014"), collection.RetrieveDateTime("Date"));
        }
예제 #6
0
        public void RetrieveNumberAsMultipleTypes()
        {
            DataValueCollection <string> collection = new DataValueCollection <string>();

            collection.Set("Number", 100);

            Assert.AreEqual(100, collection.RetrieveInt16("Number"));
            Assert.AreEqual(100, collection.RetrieveInt32("Number"));
            Assert.AreEqual(100, collection.RetrieveInt64("Number"));
            Assert.AreEqual(100, collection.RetrieveDouble("Number"));
            Assert.AreEqual(100, collection.RetrieveDecimal("Number"));
            Assert.AreEqual("100", collection.RetrieveString("Number"));
        }