public void FilterByIds_String()
        {
            List <String> ids = new List <String> {
                "9I", "10I"
            };

            IQueryable <TestModel> actual   = lookup.FilterByIds(lookup.GetModels(), ids);
            IQueryable <TestModel> expected = lookup.GetModels().Where(model => ids.Contains(model.Id !));

            Assert.Equal(expected, actual);
        }
        public void FilterByIds_NoIdProperty_Throws()
        {
            TestLookup <NoIdModel> testLookup = new TestLookup <NoIdModel>();

            LookupException exception = Assert.Throws <LookupException>(() => testLookup.FilterByIds(Array.Empty <NoIdModel>().AsQueryable(), Array.Empty <String>()));

            String expected = $"'{typeof(NoIdModel).Name}' type does not have key or property named 'Id', required for automatic id filtering.";
            String actual   = exception.Message;

            Assert.Equal(expected, actual);
        }
        public void FilterByIds_NumberKey()
        {
            TestLookup <Int32Model> testLookup = new TestLookup <Int32Model>();

            for (Int32 i = 0; i < 20; i++)
            {
                testLookup.Models.Add(new Int32Model {
                    Value = i
                });
            }

            IQueryable <Int32Model> actual = testLookup.FilterByIds(testLookup.GetModels(), new List <String> {
                "9", "10"
            });
            IQueryable <Int32Model> expected = testLookup.GetModels().Where(model => new[] { 9, 10 }.Contains(model.Value));

            Assert.Equal(expected, actual);
        }
        public void FilterByIds_Guids()
        {
            TestLookup <GuidModel> testLookup = new TestLookup <GuidModel>();

            for (Int32 i = 0; i < 20; i++)
            {
                testLookup.Models.Add(new GuidModel {
                    Id = Guid.NewGuid()
                });
            }
            List <String> ids = new List <String> {
                testLookup.Models[4].Id.ToString(), testLookup.Models[9].Id.ToString()
            };

            IQueryable <GuidModel> expected = testLookup.GetModels().Where(model => ids.Contains(model.Id.ToString()));
            IQueryable <GuidModel> actual   = testLookup.FilterByIds(testLookup.GetModels(), ids);

            Assert.Equal(expected, actual);
        }