Пример #1
0
        public void Run_HasFileLength_LengthIsWrittenToConsole()
        {
            var fileEntry = new FileEntry
            {
                FullName = "SomeFile.txt",
                Length   = 123456789
            };

            string expectedLengthString = SizeFormatter.GetSizeString(fileEntry.Length);

            // Setup

            var settingsRepoMock = new Mock <ISettingsRepository>();

            Dependency.RegisterInstance(settingsRepoMock.Object);

            var consoleAdapterMock = new Mock <IConsoleAdapter>();

            Dependency.RegisterInstance(consoleAdapterMock.Object);

            // Test

            var displayController = new DisplayController();

            displayController.Display(new RunSettings(), fileEntry.AsArray());

            // Assert

            consoleAdapterMock.Verify(ca => ca.Write(expectedLengthString), Times.Once());
        }
Пример #2
0
        public void GetSizeString_SizeIs69Gigabytes_ReturnsCorrectString()
        {
            string sizeString = SizeFormatter.GetSizeString(69123123123);

            Assert.AreEqual(" 69 GB", sizeString);
        }
Пример #3
0
        public void GetSizeString_SizeIs234Megabytes_ReturnsCorrectString()
        {
            string sizeString = SizeFormatter.GetSizeString(234000000);

            Assert.AreEqual("234 MB", sizeString);
        }
Пример #4
0
        public void GetSizeString_SizeIs55Megabytes_ReturnsCorrectString()
        {
            string sizeString = SizeFormatter.GetSizeString(55000222);

            Assert.AreEqual(" 55 MB", sizeString);
        }
Пример #5
0
        public void GetSizeString_SizeIs123Kilobytes_ReturnsCorrectString()
        {
            string sizeString = SizeFormatter.GetSizeString(123000);

            Assert.AreEqual("123 KB", sizeString);
        }
Пример #6
0
        public void GetSizeString_SizeIs23Kilobytes_ReturnsCorrectStringAndTruncatesDigits()
        {
            string sizeString = SizeFormatter.GetSizeString(23567);

            Assert.AreEqual(" 23 KB", sizeString);
        }
Пример #7
0
        public void GetSizeString_SizeIs290Bytes_ReturnsCorrectString()
        {
            string sizeString = SizeFormatter.GetSizeString(290);

            Assert.AreEqual("290 B ", sizeString);
        }
Пример #8
0
        public void GetSizeString_SizeIs9Exabytes_ReturnsCorrectString()
        {
            string sizeString = SizeFormatter.GetSizeString(9000000000000000000);

            Assert.AreEqual("  9 EB", sizeString);
        }
Пример #9
0
        public void GetSizeString_PassesZero_ReturnsCorrectString()
        {
            string sizeString = SizeFormatter.GetSizeString(0);

            Assert.AreEqual("  0 B ", sizeString);
        }
Пример #10
0
        public void GetSizeString_SizeIs567Petabytes_ReturnsCorrectString()
        {
            string sizeString = SizeFormatter.GetSizeString(567000000000000000);

            Assert.AreEqual("567 PB", sizeString);
        }
Пример #11
0
        public void GetSizeString_SizeIs42Petabytes_ReturnsCorrectString()
        {
            string sizeString = SizeFormatter.GetSizeString(42000000000000001);

            Assert.AreEqual(" 42 PB", sizeString);
        }
Пример #12
0
        public void GetSizeString_SizeIs1Petabyte_ReturnsCorrectString()
        {
            string sizeString = SizeFormatter.GetSizeString(1000000000000000);

            Assert.AreEqual("  1 PB", sizeString);
        }
Пример #13
0
        public void GetSizeString_SizeIs456Terabytes_ReturnsCorrectString()
        {
            string sizeString = SizeFormatter.GetSizeString(456000000000000);

            Assert.AreEqual("456 TB", sizeString);
        }
Пример #14
0
        public void GetSizeString_SizeIs345Gigabytes_ReturnsCorrectString()
        {
            string sizeString = SizeFormatter.GetSizeString(345000000000);

            Assert.AreEqual("345 GB", sizeString);
        }
Пример #15
0
 public void GetSizeString_PassesNegativeSize_ThrowsArgumentException()
 {
     SizeFormatter.GetSizeString(-1);
 }