private static void VerifyEnumVsStringFilterExpressionReverse(FilterClause filter) { var enumtypeRef = new EdmEnumTypeReference(UriEdmHelpers.FindEnumTypeFromModel(HardCodedTestModel.TestModel, "Fully.Qualified.Namespace.ColorPattern"), true); var bin = filter.Expression.ShouldBeBinaryOperatorNode(BinaryOperatorKind.Equal).And; bin.Right.ShouldBeSingleValuePropertyAccessQueryNode(HardCodedTestModel.GetPet2PetColorPatternProperty()); bin.Left.ShouldBeEnumNode(new ODataEnumValue("2", enumtypeRef.FullName())); }
public void TypesFromReferencedModelsAreResolveable() { // arrange var mainText = @"include ""common"" as common type Employee { employmentType: common.EmploymentType }"; var inclText = "namespace com.example.common enum EmploymentType { }"; var main = parser.Parse(mainText, "main"); var incl = parser.Parse(inclText, "incl"); var env = new TypeEnvironment(NullLogger.Instance); env.AddReferences(main, new Dictionary <string, RdmDataModel> { ["common"] = incl }); // act var actual = env.ResolveTypeReference(new RdmTypeReference("common.EmploymentType")); // assert // note that the enumeration has zero members var expected = new EdmEnumTypeReference(new EdmEnumType("com.example.common", "EmploymentType"), false); Assert.Equal(expected.FullName(), actual.FullName()); }
public void FullTypeNameAndFullNameIEdmTypeReferenceShouldBeEqual() { var enumType = new EdmEnumTypeReference(new EdmEnumType("n", "enumtype"), false); enumType.FullName().Should().Be(enumType.Definition.FullTypeName()); }