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

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

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

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

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

            var mapper = new ListItemWrapper(item);

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

            item["MyNumber"] = null;

            var mapper = new ListItemWrapper(item);

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