Exemple #1
0
        public void TestDownloadDocumentationToWhenDownloadFails()
        {
            // GIVEN the web client cannot download the file
            mockIWebClientUtility.Setup(w => w.DownloadFile("/DarkRift2/Releases/a-version/Docs/", "a-staging-path")).Throws(new WebException("mock-exception"));

            // WHEN I download a free server
            RemoteRepository classUnderTest = new RemoteRepository(null, null, mockIWebClientUtility.Object, mockIFileUtility.Object);
            bool             result         = classUnderTest.DownloadDocumentationTo("a-version", "a-download-path");

            // THEN the result is not success
            Assert.IsFalse(result);
        }
Exemple #2
0
        public void TestDownloadDocumentationTo()
        {
            // WHEN I download a free server
            RemoteRepository classUnderTest = new RemoteRepository(null, null, mockIWebClientUtility.Object, mockIFileUtility.Object);
            bool             result         = classUnderTest.DownloadDocumentationTo("a-version", "a-download-path");

            // THEN the result is success
            Assert.IsTrue(result);

            // AND the download was made
            mockIWebClientUtility.Verify(w => w.DownloadFile("/DarkRift2/Releases/a-version/Docs/", "a-staging-path"));

            // AND the download was extracted to the correct location
            mockIFileUtility.Verify(f => f.ExtractZipTo("a-staging-path", "a-download-path"));

            // AND the temporary file was deleted again
            mockIFileUtility.Verify(f => f.Delete("a-staging-path"));
        }