Пример #1
0
        public void ULInstanceGetters_should_set_dll_directory_at_its_static_constructor()
        {
            using (new IndirectionsContext())
            {
                // Arrange
                var inprocServer32KeyMock = new PProxyRegistryKeyMock();
                inprocServer32KeyMock.SetupGetValueString("", @"C:\Users\urasa\Prig\Release\x64\Urasandesu.Prig.dll");
                var classesRootMock = new PRegistryKeyMock();
                classesRootMock.SetupOpenSubKeyString(@"CLSID\{532C1F05-F8F3-4FBA-8724-699A31756ABD}\InprocServer32", inprocServer32KeyMock);

                var instanceGetters = new PULInstanceGettersMock();
                instanceGetters.SetupSetDllDirectoryString(@"C:\Users\urasa\Prig\Release\x64");


                // Act
                // static constructor will be called when referencing any static members
                var _ = ULInstanceGetters.WeaverDirectory;


                // Assert
                inprocServer32KeyMock.VerifyGetValueString();
                classesRootMock.VerifyOpenSubKeyString();
                instanceGetters.VerifySetDllDirectoryString();
            }
        }
Пример #2
0
        public void ULInstanceGetters_should_set_dll_directory_at_its_static_constructor()
        {
            using (new IndirectionsContext())
            {
                // Arrange
                var inprocServer32KeyMock = new PProxyRegistryKeyMock();
                inprocServer32KeyMock.SetupGetValueString("", @"C:\Users\urasa\Prig\Release\x64\Urasandesu.Prig.dll");
                var classesRootMock = new PRegistryKeyMock();
                classesRootMock.SetupOpenSubKeyString(@"CLSID\{532C1F05-F8F3-4FBA-8724-699A31756ABD}\InprocServer32", inprocServer32KeyMock);

                var instanceGetters = new PULInstanceGettersMock();
                instanceGetters.SetupSetDllDirectoryString(@"C:\Users\urasa\Prig\Release\x64");

                // Act
                // static constructor will be called when referencing any static members
                var _ = ULInstanceGetters.WeaverDirectory;

                // Assert
                inprocServer32KeyMock.VerifyGetValueString();
                classesRootMock.VerifyOpenSubKeyString();
                instanceGetters.VerifySetDllDirectoryString();
            }
        }
Пример #3
0
        public void ULInstanceGetters_should_set_dll_directory_at_its_initializer()
        {
            using (new IndirectionsContext())
            {
                // Arrange
                var inprocServer32KeyMock = new PProxyRegistryKeyMock();
                inprocServer32KeyMock.SetupGetValueString("", @"C:\Users\urasa\Prig\Release\x64\Urasandesu.Prig.dll");
                var classesRootMock = new PRegistryKeyMock();
                classesRootMock.SetupOpenSubKeyString(@"CLSID\{532C1F05-F8F3-4FBA-8724-699A31756ABD}\InprocServer32", inprocServer32KeyMock);

                var instanceGetters = new PULInstanceGettersMock();
                instanceGetters.SetupSetDllDirectoryString(@"C:\Users\urasa\Prig\Release\x64");


                // Act
                ULInstanceGetters.Initialize();


                // Assert
                inprocServer32KeyMock.VerifyGetValueString();
                classesRootMock.VerifyOpenSubKeyString();
                instanceGetters.VerifySetDllDirectoryString();
            }
        }