Beispiel #1
0
        public void GetIntegerFromStringTest()
        {
            var expected = 42;
            var item     = CreateFakeItem();

            item["MyNumber"] = expected.ToString();

            var mapper = new ListItemWrapper(item);
            var actual = mapper.GetInt("MyNumber");

            Assert.AreEqual(expected, actual);
        }
Beispiel #2
0
        public void GetIntegerErrorFromStringTest()
        {
            var item = CreateFakeItem();

            item["MyNumber"] = "Not a number";

            var mapper = new ListItemWrapper(item);

            Assert.ThrowsException <FormatException>(() =>
            {
                mapper.GetInt("MyNumber");
            });
        }
Beispiel #3
0
        public void GetIntegerErrorFromNullTest()
        {
            var item = CreateFakeItem();

            item["MyNumber"] = null;

            var mapper = new ListItemWrapper(item);

            Assert.ThrowsException <NullReferenceException>(() =>
            {
                mapper.GetInt("MyNumber");
            });
        }