public async Task VisitAsync(ODataPath path) { NotFound = false; BadRequest = false; Result = null; ResultType = null; PropertySetter = null; Index = 0; foreach (var segment in path) { await(segment switch { TypeSegment typeSegment => VisitAsync(typeSegment), NavigationPropertySegment navigationPropertySegment => VisitAsync(navigationPropertySegment), EntitySetSegment entitySetSegment => VisitAsync(entitySetSegment), SingletonSegment singletonSegment => VisitAsync(singletonSegment), KeySegment keySegment => VisitAsync(keySegment), PropertySegment propertySegment => VisitAsync(propertySegment), AnnotationSegment annotationSegment => VisitAsync(annotationSegment), OperationImportSegment operationImportSegment => VisitAsync(operationImportSegment), OperationSegment operationSegment => VisitAsync(operationSegment), DynamicPathSegment dynamicPathSegment => VisitAsync(dynamicPathSegment), CountSegment countSegment => VisitAsync(countSegment), FilterSegment filterSegment => VisitAsync(filterSegment), ReferenceSegment referenceSegment => VisitAsync(referenceSegment), EachSegment eachSegment => VisitAsync(eachSegment), NavigationPropertyLinkSegment navigationPropertyLinkSegment => VisitAsync(navigationPropertyLinkSegment), ValueSegment valueSegment => VisitAsync(valueSegment), BatchSegment batchSegment => VisitAsync(batchSegment), BatchReferenceSegment batchReferenceSegment => VisitAsync(batchReferenceSegment), MetadataSegment metadataSegment => VisitAsync(metadataSegment), PathTemplateSegment pathTemplateSegment => VisitAsync(pathTemplateSegment), _ => throw new NotSupportedException() });
public void InequalityIsCorrect() { CountSegment segment1 = CountSegment.Instance; BatchSegment segment2 = BatchSegment.Instance; segment1.Equals(segment2).Should().BeFalse(); }
public void InequalityIsCorrect() { CountSegment segment1 = CountSegment.Instance; BatchSegment segment2 = BatchSegment.Instance; Assert.NotSame(segment1, segment2); }
/// <summary> /// Handle a BatchSegment /// </summary> /// <param name="segment">the segment to handle</param> public override void Handle(BatchSegment segment) { Contract.Assert(segment != null); _navigationSource = null; _pathUriLiteral.Add(ODataSegmentKinds.Batch); }
public void InequalityIsCorrect() { BatchSegment segment1 = BatchSegment.Instance; CountSegment segment2 = CountSegment.Instance; Assert.False(segment1.Equals(segment2)); }
public void EqualityIsCorrect() { BatchSegment segment1 = BatchSegment.Instance; BatchSegment segment2 = BatchSegment.Instance; Assert.True(segment1.Equals(segment2)); }
/// <summary> /// Handle a BatchSegment /// </summary> /// <param name="segment">the segment to handle</param> public override void Handle(BatchSegment segment) { _navigationSource = null; _pathTemplate.Add(ODataSegmentKinds.Batch); _pathUriLiteral.Add(ODataSegmentKinds.Batch); }
public void EqualityIsCorrect() { BatchSegment segment1 = BatchSegment.Instance; BatchSegment segment2 = BatchSegment.Instance; segment1.Equals(segment2).Should().BeTrue(); }
public void InequalityCorrect() { PropertySegment propertySegment1 = new PropertySegment(HardCodedTestModel.GetPersonNameProp()); PropertySegment propertySegment2 = new PropertySegment(HardCodedTestModel.GetPersonShoeProp()); BatchSegment batchSegment = BatchSegment.Instance; propertySegment1.Equals(propertySegment2).Should().BeFalse(); propertySegment1.Equals(batchSegment).Should().BeFalse(); }
public void InequalityIsCorrect() { TypeSegment typeSegment1 = new TypeSegment(HardCodedTestModel.GetPersonType(), null); TypeSegment typeSegment2 = new TypeSegment(HardCodedTestModel.GetDogType(), null); BatchSegment batchSegment = BatchSegment.Instance; typeSegment1.Equals(typeSegment2).Should().BeFalse(); typeSegment1.Equals(batchSegment).Should().BeFalse(); }
public void InequalityCorrect() { AnnotationSegment annotationSegment1 = new AnnotationSegment(HardCodedTestModel.GetPrimitiveAnnotationTerm()); AnnotationSegment annotationSegment2 = new AnnotationSegment(HardCodedTestModel.GetComplexAnnotationTerm()); BatchSegment batchSegment = BatchSegment.Instance; annotationSegment1.Equals(annotationSegment2).Should().BeFalse(); annotationSegment1.Equals(batchSegment).Should().BeFalse(); }
public void InequalityIsCorrect() { ValueSegment segment1 = new ValueSegment(ModelBuildingHelpers.BuildValidEntityType()); ValueSegment segment2 = new ValueSegment(ModelBuildingHelpers.BuildValidComplexType()); BatchSegment segment3 = BatchSegment.Instance; Assert.False(segment1.Equals(segment2)); Assert.False(segment1.Equals(segment3)); }
public void InequalityIsCorrect() { EntitySetSegment segment1 = new EntitySetSegment(HardCodedTestModel.GetPeopleSet()); EntitySetSegment segment2 = new EntitySetSegment(HardCodedTestModel.GetDogsSet()); BatchSegment segment3 = BatchSegment.Instance; segment1.Equals(segment2).Should().BeFalse(); segment1.Equals(segment3).Should().BeFalse(); }
public void InequalityIsCorrect() { OpenPropertySegment openPropertySegment1 = new OpenPropertySegment("superbeans"); OpenPropertySegment openPropertySegment2 = new OpenPropertySegment("incredibeans"); BatchSegment segment = BatchSegment.Instance; openPropertySegment1.Equals(openPropertySegment2).Should().BeFalse(); openPropertySegment2.Equals(segment).Should().BeFalse(); }
public static string ToUriLiteral(this BatchSegment segment) { if (segment == null) { throw Error.ArgumentNull("segment"); } return(ODataSegmentKinds.Batch); }
public void InequalityCorrect() { NavigationPropertyLinkSegment navigationPropertyLinkSegment1 = new NavigationPropertyLinkSegment(HardCodedTestModel.GetPersonMyDogNavProp(), null); NavigationPropertyLinkSegment navigationPropertyLinkSegment3 = new NavigationPropertyLinkSegment(HardCodedTestModel.GetDogMyPeopleNavProp(), null); BatchSegment segment3 = BatchSegment.Instance; navigationPropertyLinkSegment1.Equals(navigationPropertyLinkSegment3).Should().BeFalse(); navigationPropertyLinkSegment1.Equals(segment3).Should().BeFalse(); }
public void Translate_BatchSegment_To_BatchPathSegment_Works() { // Arrange BatchSegment segment = BatchSegment.Instance; // Act IEnumerable <ODataPathSegment> segments = _translator.Translate(segment); // Assert ODataPathSegment pathSegment = Assert.Single(segments); Assert.IsType <BatchPathSegment>(pathSegment); }
public override void Handle(BatchSegment segment) { this.ThrowIfResolved(); this.NavigationSource = null; this.Property = null; this.Type = null; this.ElementType = this.GetElementType(this.Type); this.childSegments.Add(segment); this.canonicalSegments.Add(segment); }
public void InequalityIsCorrect() { DynamicPathSegment segment1 = new DynamicPathSegment("superbeans"); DynamicPathSegment segment2 = new DynamicPathSegment("incredibeans"); DynamicPathSegment segment3 = new DynamicPathSegment("superbeans", HardCodedTestModel.GetPersonType(), HardCodedTestModel.GetPeopleSet(), true); DynamicPathSegment segment4 = new DynamicPathSegment("incredibeans", HardCodedTestModel.GetPersonType(), HardCodedTestModel.GetPeopleSet(), true); DynamicPathSegment segment5 = new DynamicPathSegment("superbeans", HardCodedTestModel.GetDogType(), HardCodedTestModel.GetPeopleSet(), true); DynamicPathSegment segment6 = new DynamicPathSegment("superbeans", HardCodedTestModel.GetPersonType(), HardCodedTestModel.GetPaintingsSet(), true); DynamicPathSegment segment7 = new DynamicPathSegment("superbeans", HardCodedTestModel.GetPersonType(), HardCodedTestModel.GetPeopleSet(), false); BatchSegment segment = BatchSegment.Instance; Assert.False(segment1.Equals(segment2)); Assert.False(segment2.Equals(segment)); Assert.False(segment1.Equals(segment3)); Assert.False(segment3.Equals(segment4)); Assert.False(segment3.Equals(segment5)); Assert.False(segment3.Equals(segment6)); Assert.False(segment3.Equals(segment7)); }
public void InequalityIsCorrect() { OperationImportSegment operationSegment1 = new OperationImportSegment(new List <IEdmOperationImport>() { HardCodedTestModel.GetFunctionImportForGetCoolestPerson() }, HardCodedTestModel.GetPeopleSet()); OperationImportSegment operationSegment2 = new OperationImportSegment(new List <IEdmOperationImport>() { HardCodedTestModel.GetFunctionImportForGetCoolestPerson() }, null); OperationImportSegment operationSegment3 = new OperationImportSegment(new List <IEdmOperationImport>() { HardCodedTestModel.GetFunctionImportForGetCoolPeople() }, HardCodedTestModel.GetPeopleSet()); BatchSegment segment = BatchSegment.Instance; operationSegment1.Equals(operationSegment2).Should().BeFalse(); operationSegment1.Equals(operationSegment3).Should().BeFalse(); operationSegment1.Equals(segment).Should().BeFalse(); }
/// <summary> /// Translate BatchSegment to linq expression. /// </summary> /// <param name="segment">The BatchSegment</param> /// <returns>The linq expression</returns> public override Expression Translate(BatchSegment segment) { throw new NotImplementedException("BatchSegment translation is not supported"); }
/// <summary> /// Translate a BatchSegment /// </summary> /// <param name="segment">the segment to Translate</param> /// <returns>Defined by the implementer.</returns> public virtual T Translate(BatchSegment segment) { throw new NotImplementedException(); }
/// <summary> /// Translate a BatchSegment /// </summary> /// <param name="segment">the segment to Translate</param> /// <returns>Translated WebApi path segment.</returns> public override IEnumerable <ODataPathSegment> Translate(BatchSegment segment) { yield return(new BatchPathSegment()); }
/// <summary> /// Translate a BatchSegment /// </summary> /// <param name="segment">the segment to Translate</param> /// <returns>Defined by the implementer.</returns> public override string Translate(BatchSegment segment) { return(string.Empty); }
/// <summary> /// Handle a BatchSegment /// </summary> /// <param name="segment">the segment to Handle</param> public virtual void Handle(BatchSegment segment) { throw new NotImplementedException(); }
/// <summary> /// Translate a BatchSegment /// </summary> /// <param name="segment">the segment to Translate</param> /// <returns>UserDefinedValue</returns> /// <exception cref="System.ArgumentNullException">Throws if the input segment is null.</exception> public override bool Translate(BatchSegment segment) { ExceptionUtils.CheckArgumentNotNull(segment, "segment"); return(false); }
/// <summary> /// Handle a BatchSegment /// </summary> /// <param name="segment">the segment to handle</param> public override void Handle(BatchSegment segment) { }
/// <summary> /// Translate a BatchSegment /// </summary> /// <param name="segment">the segment to Translate</param> /// <returns>Defined by the implementer.</returns> public override string Translate(BatchSegment segment) { throw new NotImplementedException(); }
/// <summary> /// Translate a BatchSegment /// </summary> /// <param name="segment">the segment to Translate</param> /// <returns>Translated the path segment template.</returns> public override ODataPathSegmentTemplate Translate(BatchSegment segment) { return(new ODataPathSegmentTemplate <BatchSegment>()); }
/// <summary> /// Translate a BatchSegment /// </summary> /// <param name="segment">the segment to Translate</param> /// <returns>Translated odata path segment.</returns> public override ODataPathSegment Translate(BatchSegment segment) { return(segment); }
/// <summary> /// Translate a BatchSegment /// </summary> /// <param name="segment">the segment to Translate</param> /// <returns>Translated the path segment template.</returns> public override ODataSegmentTemplate Translate(BatchSegment segment) { throw new ODataException(Error.Format(SRResources.TargetKindNotImplemented, "ODataPathSegment", "BatchSegment")); }