public void ShouldExpectException_WhenConvertedExpressionHasWrongFieldName() { const string originalExpression = "Id eq 456 and Tags/any(t: t eq 'Dummy') and Details/Description eq 'Desc'"; var fakeFieldMapper = new StubIFieldMapper() { MapStringStringString = (productPropertyName, propertyParentName, root) => { if (productPropertyName == "Id") { return("Id"); } if (productPropertyName == "Tags" && string.IsNullOrEmpty(propertyParentName)) { return("Tags"); } if (productPropertyName == "Description" && propertyParentName == "Details") { return("DetailsDescription"); } return(""); } }; var productEdmModel = Product.GetEdmModel(); var productDocsEdmModel = ProductDoc.GetProductsModel(); _odataConverter = new ODataConverter(productEdmModel, typeof(Product), productDocsEdmModel, typeof(ProductDoc), fakeFieldMapper); var convertedExpression = _odataConverter.Convert(originalExpression); }
public ODataConverterTests() { _fieldMapper = new ProductFieldMapper(); var productEdmModel = Product.GetEdmModel(); var productDocsEdmModel = ProductDoc.GetProductsModel(); _odataConverter = new ODataConverter(productEdmModel, typeof(Product), productDocsEdmModel, typeof(ProductDoc), _fieldMapper); }
public ProductsController() { _queryService = new InMemoryProductsQueryService(); var fieldMapper = new ProductFieldMapper(); var productEdmModel = Product.GetEdmModel(); var productDocsEdmModel = ProductDoc.GetProductsModel(); _oDataConverter = new ODataConverter(productEdmModel, typeof(Product), productDocsEdmModel, typeof(ProductDoc), fieldMapper); }