public void Creates_ATempFile()
        {
            Stub.On (file1).Method ("GetBinaryContentForVersion").Will (Return.Value (new byte[] {2, 34, 5}));
            Stub.On (file1).GetProperty ("PathInRepository").Will (Return.Value ("test_repo/use_cases.odt".OsIndependentPath ()));

            var creator = new TempFileCreator (provider);
            var createdFile = creator.CreateTempFileFromVersion (file1, version1);

            Assert.IsTrue (File.Exists (createdFile));
        }
        public void CreatedTempFile_HasSameEndingAsTheOriginalFile()
        {
            Stub.On (file1).Method ("GetBinaryContentForVersion").Will (Return.Value (new byte[] {2, 3, 4, 5}));
            Stub.On (file1).GetProperty ("PathInRepository").Will (Return.Value ("test_repo/use_cases.odt".OsIndependentPath ()));

            var creator = new TempFileCreator (provider);
            var createdFile = creator.CreateTempFileFromVersion (file1, version1);

            StringAssert.EndsWith (".odt", createdFile);
        }
        public void Creates_ATempFile_WithTheSameContentAsTheOriginal()
        {
            var result = new byte[] { 2, 34, 5 };
            Stub.On (file1).Method ("GetBinaryContentForVersion").Will (Return.Value (result));
            Stub.On (file1).GetProperty ("PathInRepository").Will (Return.Value ("test_repo/use_cases.odt".OsIndependentPath ()));

            var creator = new TempFileCreator (provider);
            var createdFile = creator.CreateTempFileFromVersion (file1, version1);

            var bytesRead = File.ReadAllBytes (createdFile);

            Assert.AreEqual (result, bytesRead);
        }