Пример #1
0
        public void TestDownloadVersionToWhenPro()
        {
            // GIVEN the invoice manager returns an invoice number
            mockIInvoiceManager.Setup(i => i.GetInvoiceNumber()).Returns("an-invoice-number");

            // WHEN I download a pro server
            RemoteRepository classUnderTest = new RemoteRepository(mockIInvoiceManager.Object, null, mockIWebClientUtility.Object, mockIFileUtility.Object);
            bool             result         = classUnderTest.DownloadVersionTo("a-version", ServerTier.Pro, ServerPlatform.Core, "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/Pro/Core/?invoice=an-invoice-number", "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"));
        }