public void SelectBindingShouldCheckForExtendedModelInterfaceAndLookupOperationsByBindingType() { IEdmEntityType dummyBindingType = new EdmEntityType("Fake", "Type"); IEdmEntityTypeReference dummyTypeReference = new EdmEntityTypeReference(dummyBindingType, false); var function1 = new EdmFunction("Name.Space", "FakeFunction1", new EdmPrimitiveTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Int32), true), true, null, false); function1.AddParameter("bindingParameter", dummyTypeReference); var function2 = new EdmFunction("Name.Space", "FakeFunction1", new EdmPrimitiveTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Int64), true), true, null, false); function2.AddParameter("bindingParameter", dummyTypeReference); var dummyOperations = new[] { function1, function2 }; var resolver = new DummyFunctionImportResolver { FindOperations = (bindingType) => { bindingType.Should().BeSameAs(dummyBindingType); return(dummyOperations); } }; ODataPathSegment segment = SelectPathSegmentTokenBinder.ConvertNonTypeTokenToSegment(new NonSystemToken("Name.Space.FakeFunction1", null, null), resolver, dummyBindingType, DefaultUriResolver); segment.ShouldBeOperationSegment(dummyOperations /* TODO: parameters */); }
public void ActionNameResultsInOperationSelectionItemWithAllMatchingOverloadsMatchingBindingType() { ODataPathSegment segment = SelectPathSegmentTokenBinder.ConvertNonTypeTokenToSegment(new NonSystemToken("Fully.Qualified.Namespace.Move", null, null), HardCodedTestModel.TestModel, HardCodedTestModel.GetPersonType(), DefaultUriResolver); segment.ShouldBeOperationSegment(HardCodedTestModel.GetMoveOverloadForPerson()); }
public void ActionNameResultsInOperationSelectionForDerivedBindingTypeItemWithAllMatchingOverloads() { ODataPathSegment segment = SelectPathSegmentTokenBinder.ConvertNonTypeTokenToSegment(new NonSystemToken("Fully.Qualified.Namespace.Move", null, null), HardCodedTestModel.TestModel, HardCodedTestModel.GetEmployeeType(), DefaultUriResolver); segment.ShouldBeOperationSegment(HardCodedTestModel.GetMoveOverloadForEmployee() /* TODO: parameters */); }
public void FunctionNameResultsInOperationSelectionItemWithOnlyOverloadsBoundToTheGivenType() { ODataPathSegment segment = SelectPathSegmentTokenBinder.ConvertNonTypeTokenToSegment(new NonSystemToken("Fully.Qualified.Namespace.HasDog", null, null), HardCodedTestModel.TestModel, HardCodedTestModel.GetEmployeeType(), DefaultUriResolver); segment.ShouldBeOperationSegment(HardCodedTestModel.GetHasDogOverloadForEmployee()); }
public void FunctionNameResultsInOperationSelectionItemWithAllMatchingOverloads() { ODataPathSegment segment = SelectPathSegmentTokenBinder.ConvertNonTypeTokenToSegment(new NonSystemToken("Fully.Qualified.Namespace.HasDog", null, null), HardCodedTestModel.TestModel, HardCodedTestModel.GetPersonType(), DefaultUriResolver); segment.ShouldBeOperationSegment(HardCodedTestModel.GetAllHasDogFunctionOverloadsForPeople() /* TODO: parameters */); }
public void ActionNameResultsInOperationSelectionItem() { ODataPathSegment segment = SelectPathSegmentTokenBinder.ConvertNonTypeTokenToSegment(new NonSystemToken("Fully.Qualified.Namespace.Walk", null, null), HardCodedTestModel.TestModel, HardCodedTestModel.GetDogType(), DefaultUriResolver); segment.ShouldBeOperationSegment(HardCodedTestModel.GetDogWalkAction()); }
public void QualifiedActionNameOnOpenTypeShouldBeInterpretedAsAnOperation() { ODataPathSegment segment = SelectPathSegmentTokenBinder.ConvertNonTypeTokenToSegment(new NonSystemToken("Fully.Qualified.Namespace.Restore", null, null), HardCodedTestModel.TestModel, HardCodedTestModel.GetPaintingType(), DefaultUriResolver); segment.ShouldBeOperationSegment(HardCodedTestModel.GetRestoreAction()); }