public void AnonymousTypePropertyNamesAreNotMinimized() { var compilation = new SimpleCompilation(new CSharpProjectContent()); var er = new MockErrorReporter(true); var md = new MetadataImporter(er, compilation, new CompilerOptions()); Assert.That(er.AllMessages, Is.Empty, "Prepare should not generate errors"); var t = CreateType(compilation); var p1 = md.GetPropertySemantics(t.GetProperties().Single(p => p.Name == "prop1")); Assert.That(p1.Type, Is.EqualTo(PropertyScriptSemantics.ImplType.Field)); Assert.That(p1.FieldName, Is.EqualTo("prop1")); var p2 = md.GetPropertySemantics(t.GetProperties().Single(p => p.Name == "Prop2")); Assert.That(p2.Type, Is.EqualTo(PropertyScriptSemantics.ImplType.Field)); Assert.That(p2.FieldName, Is.EqualTo("Prop2")); }
public void PropertiesAreImplementedAsFieldsWithTheSameName() { var compilation = new SimpleCompilation(new CSharpProjectContent()); var er = new MockErrorReporter(true); var s = new AttributeStore(compilation, er); var md = new MetadataImporter(er, compilation, s, new CompilerOptions()); Assert.That(er.AllMessages, Is.Empty, "Prepare should not generate errors"); var t = CreateType(compilation); var p1 = md.GetPropertySemantics(t.GetProperties().Single(p => p.Name == "prop1")); Assert.That(p1.Type, Is.EqualTo(PropertyScriptSemantics.ImplType.Field)); Assert.That(p1.FieldName, Is.EqualTo("prop1")); var p2 = md.GetPropertySemantics(t.GetProperties().Single(p => p.Name == "Prop2")); Assert.That(p2.Type, Is.EqualTo(PropertyScriptSemantics.ImplType.Field)); Assert.That(p2.FieldName, Is.EqualTo("Prop2")); }
public void TransparentIdentiferIsValidJavascriptIdentifierStartingWithDollar() { var compilation = new SimpleCompilation(new CSharpProjectContent()); var er = new MockErrorReporter(true); var md = new MetadataImporter(er, compilation, new CompilerOptions()); Assert.That(er.AllMessages, Is.Empty, "Prepare should not generate errors"); var t = CreateType(compilation, new[] { "<>Identifier" }); var c = md.GetPropertySemantics(t.GetProperties().Single()); Assert.That(c.Type, Is.EqualTo(PropertyScriptSemantics.ImplType.Field)); Assert.That(c.FieldName, Is.EqualTo("$Identifier")); }