Example #1
0
        private string WeavePropertyChanged(string assemblyPath)
        {
            // Disable CheckForEquality, because this will rewrite all our properties and some tests will
            // behave differently based on whether PropertyChanged is weaved or not.
            // Those differences will be unlikely to affect real world scenarios, but affect the tests:
            //   WovenCopyToRealm_ShouldAlwaysSetNullableProperties -> does not call native methods
            //   ShouldFollowMapToAttribute -> checks for (value != this.Email_) which adds two extra entries in the LogList
            // Additionally, the tests don't test the exact behavior of Realm + PropertyChanged, because the check for
            // Fody.PropertyChanged will always return 'false' (ModuleWeaver.cs@214).
            var config = new XElement("PropertyChanged");

            config.SetAttributeValue("CheckForEquality", false);
            var weaver = new propertychanged::ModuleWeaver
            {
                Config = config
            };
            var targetPath = $"{Path.GetDirectoryName(assemblyPath)}/{Path.GetFileNameWithoutExtension(assemblyPath)}_propertychanged.dll";

            weaver.ExecuteTestRun(assemblyPath, runPeVerify: false,
                                  afterExecuteCallback: module =>
            {
                var parameters = new Mono.Cecil.WriterParameters {
                    WriteSymbols = true
                };
                module.Write(targetPath, parameters);
            });
            return(targetPath);
        }
Example #2
0
        private TestResult WeavePropertyChanged(string assemblyPath)
        {
            // Disable CheckForEquality, because this will rewrite all our properties and some tests will
            // behave differently based on whether PropertyChanged is weaved or not.
            // Those differences will be unlikely to affect real world scenarios, but affect the tests:
            //   WovenCopyToRealm_ShouldAlwaysSetNullableProperties -> does not call native methods
            //   ShouldFollowMapToAttribute -> checks for (value != this.Email_) which adds two extra entries in the LogList
            // Additionally, the tests don't test the exact behavior of Realm + PropertyChanged, because the check for
            // Fody.PropertyChanged will always return 'false' (ModuleWeaver.cs@214).
            var config = new XElement("PropertyChanged");

            config.SetAttributeValue("CheckForEquality", false);
            var weaver = new propertychanged::ModuleWeaver
            {
                Config = config
            };

            return(weaver.ExecuteTestRun(assemblyPath, runPeVerify: false, ignoreCodes: new[] { "80131869" }));
        }