public void GetEntityCount_ReturnsNull_IfValueIsFalse() { // Arrange var countOption = new CountQueryOption("false", _context); // Act & Assert Assert.Null(countOption.GetEntityCount(_customers)); }
public void GetEntityCount_ReturnsCount_IfValueIsTrue() { // Arrange var countOption = new CountQueryOption("true", _context); // Act & Assert Assert.Equal(3, countOption.GetEntityCount(_customers)); }
public void GetEntityCount_WithUnTypedContext_Throws_InvalidOperation() { // Arrange CustomersModelWithInheritance model = new CustomersModelWithInheritance(); ODataQueryContext context = new ODataQueryContext(model.Model, model.Customer); CountQueryOption countOption = new CountQueryOption("true", context); IQueryable queryable = new Mock <IQueryable>().Object; // Act & Assert Assert.Throws <NotSupportedException>(() => countOption.GetEntityCount(queryable), "The query option is not bound to any CLR type. 'GetEntityCount' is only supported with a query option bound to a CLR type."); }
public void GetEntityCount_WithUnTypedContext_Throws_InvalidOperation() { // Arrange CustomersModelWithInheritance model = new CustomersModelWithInheritance(); ODataQueryContext context = new ODataQueryContext(model.Model, model.Customer); CountQueryOption countOption = new CountQueryOption("true", context); IQueryable queryable = new Mock<IQueryable>().Object; // Act & Assert Assert.Throws<NotSupportedException>(() => countOption.GetEntityCount(queryable), "The query option is not bound to any CLR type. 'GetEntityCount' is only supported with a query option bound to a CLR type."); }