Esempio n. 1
0
        public void LookupException_SetsMessage()
        {
            String actual = new LookupException("Test").Message;
            String expected = "Test";

            Assert.Equal(expected, actual);
        }
        public void FilterBySelected_NotSupportedIdType_Throws()
        {
            LookupException exception = Assert.Throws <LookupException>(() => new TestLookup <ObjectModel>().FilterBySelected(Array.Empty <ObjectModel>().AsQueryable(), Array.Empty <String>()));

            String expected = $"'{typeof(ObjectModel).Name}.Id' property type is not filterable.";
            String actual   = exception.Message;

            Assert.Equal(expected, actual);
        }
Esempio n. 3
0
        public void FilterBySelected_NotSupportedIdType_Throws()
        {
            LookupException exception = Assert.Throws <LookupException>(() => new TestLookup <ObjectModel>().FilterBySelected(null, new String[0]));

            String expected = $"'{typeof(ObjectModel).Name}.Id' property type has to be a string, guid or a number.";
            String actual   = exception.Message;

            Assert.Equal(expected, actual);
        }
        public void FilterByCheckIds_NotSupportedIdType_Throws()
        {
            LookupException exception = Assert.Throws <LookupException>(() => new TestLookup <ObjectModel>().FilterByCheckIds(Array.Empty <ObjectModel>().AsQueryable(), Array.Empty <String>()));

            String expected = $"'{typeof(ObjectModel).Name}.Id' property type has to be a string, guid or a number.";
            String actual   = exception.Message;

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

            LookupException exception = Assert.Throws <LookupException>(() => testLookup.FilterBySelected(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);
        }
Esempio n. 6
0
        public void FilterByCheckIds_NoIdProperty_Throws()
        {
            TestLookup <NoIdModel> testLookup = new TestLookup <NoIdModel>();

            LookupException exception = Assert.Throws <LookupException>(() => testLookup.FilterByCheckIds(null, null));

            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);
        }