public void Setup() { Interactions = MockRepository.GenerateStub<IInteractionContext>(); FileSync = MockRepository.GenerateStub<IFileSync>(); Context(); Because(); }
/// <summary> /// Uses dependency injection and inversion of control. By using these /// techniques we make the object constructing this object provide all /// of the external dependencies. The code is less fragile, reuse is /// encouraged, and there should be less bugs. /// Look at the DependencyLoader to see how we're telling the system to /// load the implementation classes for this class. /// </summary> /// <param name="fileSync"></param> /// <param name="userInteractions"></param> /// <param name="settings"></param> /// <param name="backupAccess"></param> public RunBackup( IFileSync fileSync, IInteractionContext userInteractions, ISettingsProvider settings, IBackupAccess backupAccess) { _FileSystem = fileSync; _Interactions = userInteractions; _Settings = settings; _BackupDirectory = backupAccess; _FileSystem.AppliedChange += OnAppliedChange; _FileSystem.SkippedChange += OnSkippedChange; }
protected void OpenFile() { try { UtlFileAccess access = this._isDump ? FileUtil.GetDefaultInstance() : this._database.logger.GetFileAccess(); Stream s = access.OpenOutputStreamElement(this.OutFile); this._outDescriptor = access.GetFileSync(s); this.FileStreamOut = new BufferedStream(s, 0x2000); } catch (IOException exception) { object[] add = new object[] { exception.Message, this.OutFile }; throw Error.GetError(exception, 0x1c4, 0x1a, add); } }
public void Setup() { //Here we're doing all of the set up for this clump of tests. // Mocks basically allow us to pretend like we have a class // when we really don't just so the program runs. This really // comes in handy when you have a large interface and don't want to // create a huge real class that has to have a bunch of empty methods // that never get called. Interactions = MockRepository.GenerateStub<IInteractionContext>(); FileSync = MockRepository.GenerateStub<IFileSync>(); BackupAccess = MockRepository.GenerateStub<IBackupAccess>(); Settings = MockRepository.GenerateStub<ISettingsProvider>(); BackupRunner = new RunBackup(FileSync, Interactions, Settings, BackupAccess); Context(); Because(); }
public FileSync(Stream stream) { remoteClientSync = DynamicWrapper.CreateClientModel <IFileSync>(new CallWriter(stream, typeof(IFileSync))); }