public void ByIntId_Enumerable_CanDisallowNull() { var data = new Permission[] { new FakeEntityWithId1(), new FakeEntityWithId2(), new FakeEntityWithId3(), }; data.AsEnumerable().ById(3, false).ShouldNotBeNull(); var exception = Assert.Throws <InvalidOperationException>(() => data.AsEnumerable().ById(int.MaxValue, false)); Assert.NotNull(exception); exception.Message.IndexOf("Sequence contains no matching element", StringComparison.CurrentCulture).ShouldEqual(0); }
public void ByIntId_Enumerable_CanDisallowNull() { var data = new Permission[] { new FakeEntityWithId1(), new FakeEntityWithId2(), new FakeEntityWithId3(), }; data.AsEnumerable().ById(3, false).ShouldNotBeNull(); var exception = Assert.Throws<InvalidOperationException>(() => data.AsEnumerable().ById(int.MaxValue, false)); Assert.NotNull(exception); exception.Message.IndexOf("Sequence contains no matching element", StringComparison.CurrentCulture) .ShouldEqual(0); }