Пример #1
0
 public void writeListToFileTest()
 {
     StreamWriter stubWriter = MockRepository.GenerateStub<StreamWriter>();
     stubWriter.Stub(x => x.Write(Arg<string>.Is.Anything,Arg<FileMode>.Is.Anything));
     fileWriter = new OverRiddenWriter_1(stubWriter);
     List<string> testData = new List<string>() { "111111-1111-1111-1111-111111111111", "222222-2222-2222-2222-22222222222" };
     string testPath = "\\not\\a\\file\\path.txt";
     fileWriter.Write(testPath,testData);
     stubWriter.AssertWasCalled(x => x.WriteLine(Arg<string>.Is.Anything));
 }
Пример #2
0
        public void createFileTest()
        {
            //Arrange
            FileStream stubFile = MockRepository.GenerateStub<FileStream>();
            fileWriter = new OverRiddenWriter_2(stubFile);
            string testPath = "\\this\\is\\not\\a\\path.dat";

            //Act
            fileWriter.Create(testPath);

            //Assert
            bool passed = ((OverRiddenWriter_2)fileWriter).wasCalled();
            Assert.IsTrue(passed);
        }
Пример #3
0
        public void WriteFileFromBytesTest()
        {
            //Arrange
            FileStream stubFile = MockRepository.GenerateMock<FileStream>();
            stubFile.Expect(x => x.Write(Arg<byte[]>.Is.Anything, Arg<int>.Is.Anything, Arg<int>.Is.Equal(1)));
            stubFile.Expect(x => x.Close());

            fileWriter = new OverRiddenWriter_2(stubFile);

            string testPath ="\\this\\is\\a\\path\\not.dat";
            byte[] aByteArrray = new byte[1];

            //Act
            fileWriter.Write(testPath,aByteArrray);

            //Assert
            stubFile.VerifyAllExpectations();
        }
Пример #4
0
 public OverRiddenAuthorisationModel_1(IAuthorisationView view, IWizard w, CertificateMaker mockMaker, FileWriter mockWriter, X509Store mockStore)
     : base(view, w)
 {
     this.mockMaker = mockMaker;
     this.mockWriter = mockWriter;
     this.mockStore = mockStore;
 }
Пример #5
0
 public void writeStringToFileTest()
 {
     StreamWriter stubWriter = MockRepository.GenerateStub<StreamWriter>();
     stubWriter.Stub(x => x.Write(Arg<string>.Is.Anything));
     fileWriter = new OverRiddenWriter_1(stubWriter);
     string testData = "111111-1111-1111-1111-111111111111";
     string testPath = "\\this\\is\\not\\a\\path.dat";
     fileWriter.Write(testPath, testData);
     stubWriter.AssertWasCalled(x => x.WriteLine(Arg<string>.Is.Anything));
 }
Пример #6
0
 public void setUp()
 {
     fileWriter = new FileWriter();
 }
Пример #7
0
 public OverRiddenWizard_2(FileWriter mockWriter)
 {
     this.mockWriter = mockWriter;
 }