public void FlushCodeToDisk() { DefineSomeType(); var assemblyAttribute = CustomAttributeDeclarationObjectMother.Create(); var fakeAssemblyPath = "fake path"; var assemblyBuilderMock = MockRepository.GenerateStrictMock <IAssemblyBuilder>(); _moduleBuilderMock.Expect(mock => mock.AssemblyBuilder).Return(assemblyBuilderMock); assemblyBuilderMock.Expect(mock => mock.SetCustomAttribute(assemblyAttribute)); assemblyBuilderMock.Expect(mock => mock.SaveToDisk()).Return(fakeAssemblyPath); var previousDebugInfoGenerator = _flusher.DebugInfoGenerator; var result = _flusher.FlushCodeToDisk(new[] { assemblyAttribute }); _moduleBuilderMock.VerifyAllExpectations(); assemblyBuilderMock.VerifyAllExpectations(); Assert.That(result, Is.EqualTo(fakeAssemblyPath)); Assert.That(_flusher.DebugInfoGenerator, Is.Not.EqualTo(previousDebugInfoGenerator)); }