コード例 #1
0
        public void WriteModuleDefinition_SignedAssembly_WriterFindsMatchingKey()
        {
            _definitionWriter = new ModuleDefinitionWriter(
                _fileSystemMock,
                null,
                new List <StrongNameKeyPair> {
                AssemblyNameReferenceObjectMother.RealKeyPair()
            });
            //_fileSystemMock
            //     .Expect (mock => mock.FileExists (_signedAssemblyDefinition.MainModule.FullyQualifiedName)).Return (true);
            //_fileSystemMock
            //     .Expect (mock => mock.FileExists (_signedAssemblyDefinition.MainModule.FullyQualifiedName + ".bak0")).Return (false);
            //_fileSystemMock
            //    .Expect (mock => mock.Move (_signedAssemblyDefinition.MainModule.FullyQualifiedName, _signedAssemblyDefinition.MainModule.FullyQualifiedName + ".bak0"));
            _fileSystemMock
            .Expect(mock => mock.WriteModuleDefinition(
                        Arg <ModuleDefinition> .Is.Same(_signedAssemblyDefinition.MainModule),
                        Arg <string> .Is.Same(_signedAssemblyDefinition.MainModule.FullyQualifiedName),
                        Arg <WriterParameters> .Matches(param => param.StrongNameKeyPair.Equals(AssemblyNameReferenceObjectMother.RealKeyPair()))));
            _fileSystemMock.Replay();

            _definitionWriter.WriteModule(_signedAssemblyDefinition.MainModule);

            _fileSystemMock.VerifyAllExpectations();
        }
コード例 #2
0
        public void WriteModuleDefinition_WriterHasDefaultKey()
        {
            //_fileSystemMock
            //     .Expect (mock => mock.FileExists (_assemblyDefinition1.MainModule.FullyQualifiedName)).Return (true);
            //_fileSystemMock
            //     .Expect (mock => mock.FileExists (_assemblyDefinition1.MainModule.FullyQualifiedName + ".bak0")).Return (false);
            //_fileSystemMock
            //    .Expect (mock => mock.Move(_assemblyDefinition1.MainModule.FullyQualifiedName, _assemblyDefinition1.MainModule.FullyQualifiedName+".bak0"));
            _fileSystemMock
            .Expect(mock => mock.WriteModuleDefinition(
                        Arg <ModuleDefinition> .Is.Same(_assemblyDefinition1.MainModule),
                        Arg <string> .Is.Same(_assemblyDefinition1.MainModule.FullyQualifiedName),
                        Arg <WriterParameters> .Matches(param => param.StrongNameKeyPair == null)));
            _fileSystemMock.Replay();

            _definitionWriter.WriteModule(_assemblyDefinition1.MainModule);

            _fileSystemMock.VerifyAllExpectations();
        }
コード例 #3
0
        public void WriteModuleDefinition_NoDefaultKey_NoAvailableKeys()
        {
            _definitionWriter = new ModuleDefinitionWriter (
              _fileSystemMock,
              null,
              new List<StrongNameKeyPair> { });
              //_fileSystemMock
              //     .Expect (mock => mock.FileExists (_assemblyDefinition1.MainModule.FullyQualifiedName)).Return (true);
              //_fileSystemMock
              //     .Expect (mock => mock.FileExists (_assemblyDefinition1.MainModule.FullyQualifiedName + ".bak0")).Return (false);
              //_fileSystemMock
              //    .Expect (mock => mock.Move (_assemblyDefinition1.MainModule.FullyQualifiedName, _assemblyDefinition1.MainModule.FullyQualifiedName + ".bak0"));
              _fileSystemMock
              .Expect (mock => mock.WriteModuleDefinition (
            Arg<ModuleDefinition>.Is.Same (_assemblyDefinition1.MainModule),
            Arg<string>.Is.Same (_assemblyDefinition1.MainModule.FullyQualifiedName),
            Arg<WriterParameters>.Matches (param => param.StrongNameKeyPair == null)));
              _fileSystemMock.Replay ();

              _definitionWriter.WriteModule (_assemblyDefinition1.MainModule);

              _fileSystemMock.VerifyAllExpectations ();
        }
コード例 #4
0
        public void WriteModuleDefinition_SignedAssembly_WriterFindsMatchingKey()
        {
            _definitionWriter = new ModuleDefinitionWriter (
              _fileSystemMock,
              null,
              new List<StrongNameKeyPair> { AssemblyNameReferenceObjectMother.RealKeyPair() });
              //_fileSystemMock
              //     .Expect (mock => mock.FileExists (_signedAssemblyDefinition.MainModule.FullyQualifiedName)).Return (true);
              //_fileSystemMock
              //     .Expect (mock => mock.FileExists (_signedAssemblyDefinition.MainModule.FullyQualifiedName + ".bak0")).Return (false);
              //_fileSystemMock
              //    .Expect (mock => mock.Move (_signedAssemblyDefinition.MainModule.FullyQualifiedName, _signedAssemblyDefinition.MainModule.FullyQualifiedName + ".bak0"));
              _fileSystemMock
              .Expect (mock => mock.WriteModuleDefinition (
            Arg<ModuleDefinition>.Is.Same (_signedAssemblyDefinition.MainModule),
            Arg<string>.Is.Same (_signedAssemblyDefinition.MainModule.FullyQualifiedName),
            Arg<WriterParameters>.Matches (param => param.StrongNameKeyPair.Equals (AssemblyNameReferenceObjectMother.RealKeyPair()))));
              _fileSystemMock.Replay ();

              _definitionWriter.WriteModule (_signedAssemblyDefinition.MainModule);

              _fileSystemMock.VerifyAllExpectations ();
        }