public void GetEdmType_Returns_TypeFromTypeNameIfNotNull() { SelectExpandWrapper <int> wrapper = new SelectExpandWrapper <int> { TypeName = _model.Customer.FullName(), Model = _model.Model }; IEdmTypeReference result = wrapper.GetEdmType(); Assert.Same(_model.Customer, result.Definition); }
public void GetEdmType_ThrowsODataException_IfTypeFromTypeNameIsNotFoundInModel() { _modelID = ModelContainer.GetModelID(EdmCoreModel.Instance); SelectExpandWrapper <int> wrapper = new SelectExpandWrapper <int> { TypeName = _model.Customer.FullName(), ModelID = _modelID }; Assert.Throws <InvalidOperationException>( () => wrapper.GetEdmType(), "Cannot find the entity type 'NS.Customer' in the model."); }
public void GetEdmType_Returns_ElementTypeIfInstanceIsNull() { _model.Model.SetAnnotationValue(_model.Customer, new ClrTypeAnnotation(typeof(TestEntity))); _model.Model.SetAnnotationValue(_model.SpecialCustomer, new ClrTypeAnnotation(typeof(DerivedEntity))); SelectExpandWrapper <TestEntity> wrapper = new SelectExpandWrapper <TestEntity> { Model = _model.Model }; IEdmTypeReference edmType = wrapper.GetEdmType(); Assert.Same(_model.Customer, edmType.Definition); }
public void GetEdmType_ThrowsODataException_IfTypeFromTypeNameIsNotFoundInModel() { // Arrange SelectExpandWrapper <int> wrapper = new SelectExpandWrapper <int> { TypeName = _model.Customer.FullName(), Model = EdmCoreModel.Instance }; // Act & Assert Assert.Throws <InvalidOperationException>( () => wrapper.GetEdmType(), "Cannot find the resource type 'NS.Customer' in the model."); }