Exemplo n.º 1
0
 public void TryCreateFileWhenDirectoryNotFound()
 {
     FileHandler<UserFile> handlerMock = MockRepository.GenerateStub<FileHandler<UserFile>>();
     handlerMock.Expect(x => x.CreateFile("")).Throw(new DirectoryNotFoundException());
     UserStorageManager manager = new UserStorageManager(handlerMock);
     manager.SetUserFile("");
 }
        public void configUserFile()
        {
            string filePath = "C:\\Users\\pbazan\\data.txt";
            FileHandler<UserFile> handlerMock = MockRepository.GenerateMock<FileHandler<UserFile>>();
            handlerMock.Expect(x => x.CreateFile(filePath)).Return(new UserFile());

            UserStorageManager manager = new UserStorageManager(handlerMock);
            manager.SetUserFile(filePath);

            handlerMock.VerifyAllExpectations();
        }