示例#1
0
        public void SetUp()
        {
            const int otherTypesCount = 3;

            otherTypes = Enumerable.Range(0, otherTypesCount).Select(x => FakeCommonTypeBuilder.Create($"OtherType{x}").Build()).ToArray();
            assembly   = FakeCommonAssemblyBuilder.Create().AddCommonTypes(otherTypes);
        }
        public void OneTimeSetUp()
        {
            applicationPatcherWpfConfiguration = new ApplicationPatcherWpfConfiguration {
                CommandFieldNameRules = new Configurations.NameRules {
                    Suffix = "Command", Type = NameRulesType.lowerCamelCase
                },
                CommandPropertyNameRules = new Configurations.NameRules {
                    Suffix = "Command", Type = NameRulesType.UpperCamelCase
                },
                CommandExecuteMethodNameRules = new Configurations.NameRules {
                    Prefix = "Execute", Suffix = "Method", Type = NameRulesType.UpperCamelCase
                },
                CommandCanExecuteMethodNameRules = new Configurations.NameRules {
                    Prefix = "CanExecute", Suffix = "Method", Type = NameRulesType.UpperCamelCase
                }
            };

            var nameRulesService = NameRulesServiceHelper.CreateService(applicationPatcherWpfConfiguration);

            commandGrouperService = new CommandGrouperService(applicationPatcherWpfConfiguration, nameRulesService);

            CommandType  = FakeCommonTypeBuilder.Create(KnownTypeNames.ICommand).Build();
            RelayCommand = FakeCommonTypeBuilder.Create(KnownTypeNames.RelayCommand, CommandType).Build();
            fakeCommonAssemblyBuilder = FakeCommonAssemblyBuilder.Create().AddCommonType(CommandType, false).AddCommonType(RelayCommand, false);
            FakeCommonTypeBuilder.ClearCreatedTypes();
        }
        public void SetUp()
        {
            const int otherTypesCount = 3;

            otherTypes = Enumerable.Range(0, otherTypesCount).Select(x => FakeCommonTypeBuilder.Create($"OtherType{x}").Build()).ToArray();

            var typeSystem = CreateMockFor <TypeSystem>();

            typeSystem.Setup(system => system.Void).Returns(() => CreateMockFor <TypeReference>().Object);

            assembly = FakeCommonAssemblyBuilder.Create().AddCommonTypes(otherTypes);
            assembly.MainMonoCecilModuleMock.Setup(module => module.TypeSystem).Returns(() => typeSystem.Object);
            assembly.MainMonoCecilModuleMock.Setup(module => module.ImportReference(It.IsAny <MethodBase>())).Returns(() => CreateMockFor <MethodReference>().Object);
        }
        public void SetUp()
        {
            applicationCommonAttributes = new ICommonAttribute[0];
            assemblyName = CreateMockFor <AssemblyNameDefinition>();

            assembly = FakeCommonAssemblyBuilder.Create();
            assembly.MainMonoCecilAssemblyMock.Setup(a => a.Name).Returns(assemblyName.Object);
            assembly.CommonAssemblyMock.Setup(commonAssembly => commonAssembly.Attributes).Returns(() => applicationCommonAttributes);

            applicationPatcherSelfConfiguration = new ApplicationPatcherSelfConfiguration {
                MonoCecilSelectedAssemblyReferenceNames           = new string[0],
                MonoCecilSelectedInternalsVisibleToAttributeNames = new string[0],
                MonoCecilNewPublicKey = new byte[0]
            };
        }
示例#5
0
        private static void CheckPublicKeyTokens(byte[] assemblyPublicKeyToken, byte[] configurationPublicKeyToken, PatchResult expectedPatchResult)
        {
            var assemblyNameDefinition = CreateMockFor <AssemblyNameDefinition>();

            assemblyNameDefinition.Setup(assemblyName => assemblyName.PublicKeyToken).Returns(assemblyPublicKeyToken);

            var assembly = FakeCommonAssemblyBuilder.Create();

            assembly.MainMonoCecilAssemblyMock.Setup(mainMonoCecilAssembly => mainMonoCecilAssembly.Name).Returns(assemblyNameDefinition.Object);

            var applicationPatcherSelfConfiguration = new ApplicationPatcherSelfConfiguration {
                MonoCecilNewPublicKeyToken = configurationPublicKeyToken
            };
            var checkAssemblyPublicKeyPatcher = new CheckAssemblyPublicKeyPatcher(applicationPatcherSelfConfiguration);
            var patchResult = checkAssemblyPublicKeyPatcher.Patch(assembly.CommonAssembly);

            patchResult.Should().Be(expectedPatchResult);
        }
示例#6
0
        public void OneTimeSetUp()
        {
            applicationPatcherWpfConfiguration = new ApplicationPatcherWpfConfiguration {
                DependencyFieldNameRules = new Configurations.NameRules {
                    Suffix = "Property", Type = NameRulesType.UpperCamelCase
                },
                DependencyPropertyNameRules = new Configurations.NameRules {
                    Type = NameRulesType.UpperCamelCase
                }
            };

            var nameRulesService = NameRulesServiceHelper.CreateService(applicationPatcherWpfConfiguration);

            dependencyGrouperService = new DependencyGrouperService(applicationPatcherWpfConfiguration, nameRulesService);

            DependencyPropertyType    = FakeCommonTypeBuilder.Create(KnownTypeNames.DependencyProperty).Build();
            fakeCommonAssemblyBuilder = FakeCommonAssemblyBuilder.Create().AddCommonType(DependencyPropertyType, false);
            FakeCommonTypeBuilder.ClearCreatedTypes();
        }
        public void OneTimeSetUp()
        {
            applicationPatcherWpfConfiguration = new ApplicationPatcherWpfConfiguration {
                FieldNameRules = new Configurations.NameRules {
                    Type = NameRulesType.lowerCamelCase
                },
                PropertyNameRules = new Configurations.NameRules {
                    Type = NameRulesType.UpperCamelCase
                }
            };

            var nameRulesService = NameRulesServiceHelper.CreateService(applicationPatcherWpfConfiguration);

            propertyGrouperService = new PropertyGrouperService(applicationPatcherWpfConfiguration, nameRulesService);

            CommandType = FakeCommonTypeBuilder.Create(KnownTypeNames.ICommand).Build();
            fakeCommonAssemblyBuilder = FakeCommonAssemblyBuilder.Create().AddCommonType(CommandType, false);
            FakeCommonTypeBuilder.ClearCreatedTypes();
        }