public void GetEntitySet_Returns_PreviousEntitySet() { // Arrange EdmEntityType castType = new EdmEntityType("NS", "Entity"); CastPathSegment castSegment = new CastPathSegment(castType); IEdmEntitySet previousEntitySet = new Mock<IEdmEntitySet>().Object; // Act var result = castSegment.GetEntitySet(previousEntitySet); // Assert Assert.Same(previousEntitySet, result); }
public void GetEdmType_ReturnsCastType_IfPreviousTypeIsNotCollection() { // Arrange EdmEntityType castType = new EdmEntityType("NS", "Entity"); EdmEntityType previousEdmType = new EdmEntityType("NS", "PreviousType"); CastPathSegment castSegment = new CastPathSegment(castType); // Act var result = castSegment.GetEdmType(previousEdmType); // Assert Assert.Equal(castType, result); }
public void GetEdmType_ReturnsCollectionCastType_IfPreviousTypeIsCollection() { // Arrange EdmEntityType castType = new EdmEntityType("NS", "Entity"); EdmCollectionType previousEdmType = new EdmCollectionType(new EdmEntityType("NS", "PreviousType").AsReference()); CastPathSegment castSegment = new CastPathSegment(castType); // Act var result = castSegment.GetEdmType(previousEdmType); // Assert Assert.Equal(EdmTypeKind.Collection, result.TypeKind); Assert.Equal(castType, (result as IEdmCollectionType).ElementType.Definition); }
public void TryMatch_ReturnsTrue_IfCastTypeMatch() { // Arrange EdmEntityType castType = new EdmEntityType("NS", "Entity"); CastPathSegment castSegment = new CastPathSegment(castType); CastPathSegment pathSegment = new CastPathSegment(castType); Dictionary<string, object> values = new Dictionary<string,object>(); // Act var result = castSegment.TryMatch(pathSegment, values); // Assert Assert.True(result); Assert.Empty(values); }