예제 #1
0
        public void can_convert_to_lookup_and_change_type()
        {
            var stubDataReader = new StubDataReader
            {
                Names  = new[] { "ID", "Name" },
                Types  = new[] { typeof(int), typeof(string) },
                Values = new object[] { 1, "hello" },
            };
            var val = stubDataReader.ToLookup <Order, int, string>(ord => ord.Id, ord => ord.Name);

            Assert.AreEqual(1, val[1].Count);
            Assert.AreEqual("hello", val[1].First());
            Assert.AreEqual(1, val.Count, "count");
        }
예제 #2
0
        public void can_convert_to_lookup()
        {
            var stubDataReader = new StubDataReader
            {
                Names  = new[] { "ID", "Name" },
                Types  = new[] { typeof(int), typeof(string) },
                Values = new object[] { 1, "hello" },
            };
            var val = stubDataReader.ToLookup <int, Order>(ord => ord.Id);

            Assert.AreEqual(1, val[1].Count);
            Assert.AreEqual(1, val[1].First().Id);
            Assert.AreEqual("hello", val[1].First().Name);
        }