コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPrintDiskUsage()
        public virtual void ShouldPrintDiskUsage()
        {
            // Not sure how to get around this w/o spying. The method that we're unit testing will construct
            // other File instances with this guy as parent and internally the File constructor uses the field 'path'
            // which, if purely mocked, won't be assigned. At the same time we want to control the total/free space methods
            // and what they return... a tough one.
            File           storeDir = Mockito.spy(new File("storeDir"));
            DatabaseLayout layout   = mock(typeof(DatabaseLayout));

            when(layout.DatabaseDirectory()).thenReturn(storeDir);
            when(storeDir.TotalSpace).thenReturn(100L);
            when(storeDir.FreeSpace).thenReturn(40L);

            AssertableLogProvider logProvider = new AssertableLogProvider();

            KernelDiagnostics.StoreFiles storeFiles = new KernelDiagnostics.StoreFiles(layout);
            storeFiles.Dump(logProvider.getLog(this.GetType()).debugLogger());

            logProvider.RawMessageMatcher().assertContains("100 / 40 / 40");
        }