public void TestMethodPropertyPropertyMapped7() { IParameter parameter = ConstructorParameter.Create <MappedTestClass>(); TypeDefinition <ITestProperties> typeDefinition = new TypeDefinition <ITestProperties> ( parameter, new DefinitionImport(parameter) ); ITestProperties test = typeDefinition.Create(new MappedTestClass()); test.Property1 = 42; Assert.AreEqual(42, test.Property1); }
public void LinkedMethodsReturnValueTest7() { CustomImplentation implementation = new CustomImplentation(); ConstructorParameter parameter = ConstructorParameter.Create <BoolContainer>("container"); TypeDefinition <ITestMethods> typeDefinition = new TypeDefinition <ITestMethods>( parameter, new LinkedMethodsReturnValue(nameof(ITestMethods.OutAndRef)) .MappedMethod(implementation, nameof(CustomImplentation.OutAndRef)) .Action <BoolContainer>(container => container.Value = true, parameter)); BoolContainer boolContainer = new BoolContainer(); ITestMethods instance = typeDefinition.Create(boolContainer); BoolContainer boolContainer2 = new BoolContainer(); typeDefinition.Create(boolContainer2); string text2 = "wetwt"; instance.OutAndRef(out string _, ref text2, 5); Assert.IsTrue(boolContainer.Value); Assert.IsFalse(boolContainer2.Value); }