Exemple #1
0
        public void AssertDBDiagnosticsSerivceReturnsDBSize()
        {
            var dbDiagnosticsService = new DatabaseDiagnosticsService();
            var dbSize = Task.Run(async() => await dbDiagnosticsService.GetDBSize()).Result;

            Assert.IsNotNull(dbSize);
            Assert.IsNotNull(dbSize.Name);
            Assert.IsNotNull(dbSize.Size);
        }
Exemple #2
0
        /// <summary>
        /// Logs the total size of the database
        /// </summary>
        private void LogDbSize()
        {
            var           dbService = new DatabaseDiagnosticsService();
            var           dataBase  = dbService.GetDBSize().Result;
            StringBuilder sb        = new StringBuilder("Database info:");

            sb.AppendLine();
            sb.AppendLine(string.Format("Database: {0}, Size: {1}, Reserved: {2}, Unallocated: {3}, Data: {4}, Index: {5}, Unused {6}",
                                        dataBase.Name, dataBase.Size, dataBase.Reserved, dataBase.Unallocated, dataBase.Data, dataBase.Index, dataBase.Unused));

            Log.Write(sb.ToString(), System.Diagnostics.TraceEventType.Information);
        }