public void Format_BinderParameterLog_ReturnsNull() { ParameterLog log = new BinderParameterLog(); string result = LogAnalysis.Format(log); Assert.Null(result); }
public void FormatTime_Hours(double hours, string expected) { // Arrange var time = TimeSpan.FromHours(hours); // Act string result = LogAnalysis.Format(time); // Assert AssertExpectedTimeString(expected, result); }
public void FormatTime_Minutes(double minutes, string expected) { // Arrange var time = TimeSpan.FromMinutes(minutes); // Act string result = LogAnalysis.Format(time); // Assert AssertExpectedTimeString(expected, result); }
public void FormatTime_Seconds(double seconds, string expected) { // Arrange var time = TimeSpan.FromSeconds(seconds); // Act string result = LogAnalysis.Format(time); // Assert AssertExpectedTimeString(expected, result); }
public void FormatTime_ZeroTime_NoOutput() { // Arrange var time = TimeSpan.Zero; // Act string result = LogAnalysis.Format(time); // Assert Assert.Equal(string.Empty, result); }
public void Format_TextParameterLog() { const string expected = "Pass-Through"; ParameterLog log = new TextParameterLog() { Value = expected }; string result = LogAnalysis.Format(log); Assert.Equal(expected, result); }
public void Format_TableParameterLog(int entitiesWritten, double elapsedTime, string expected) { ParameterLog log = new TableParameterLog() { EntitiesWritten = entitiesWritten, ElapsedWriteTime = TimeSpan.FromMilliseconds(elapsedTime) }; string result = LogAnalysis.Format(log); Assert.Equal(expected, result); }
public void Format_WriteBlobParameterLog(bool wasWritten, long bytesWritten, string expected) { ParameterLog log = new WriteBlobParameterLog() { WasWritten = wasWritten, BytesWritten = bytesWritten }; string result = LogAnalysis.Format(log); Assert.Equal(expected, result); }
public void Format_ReadBlobParameterLog(long bytesRead, long logLength, double elapsedTime, string expected) { ParameterLog log = new ReadBlobParameterLog() { BytesRead = bytesRead, Length = logLength, ElapsedTime = TimeSpan.FromMilliseconds(elapsedTime) }; string result = LogAnalysis.Format(log); Assert.Equal(expected, result); }
public void FormatTime_Milliseconds(double milliseconds, string expected) { // Arrange // this is required since the FromMilliseconds method rounds the // result (so for e.g. FromMilliseconds(0.1) will create Timespan.Zero // which is not what we are trying to test here). var time = TimeSpan.FromTicks((long)(milliseconds * 10000)); // Act string result = LogAnalysis.Format(time); // Assert AssertExpectedTimeString(expected, result); }
public void Format_SingletonParameterLog() { SingletonParameterLog log = new SingletonParameterLog { LockAcquired = false }; StringBuilder expected = new StringBuilder(); expected.AppendLine("Waiting for lock..."); Assert.Equal(expected.ToString(), LogAnalysis.Format(log)); log = new SingletonParameterLog { LockAcquired = false, TimeToAcquireLock = TimeSpan.FromSeconds(4), LockOwner = "8F4DA397-4EF4-428E-9043-FC240376165E" }; expected = new StringBuilder(); expected.AppendLine("Waiting for lock..."); expected.AppendLine("Lock Owner: 8F4DA397-4EF4-428E-9043-FC240376165E."); expected.AppendLine("Wait time: About 4 seconds."); Assert.Equal(expected.ToString(), LogAnalysis.Format(log)); log = new SingletonParameterLog { LockAcquired = true, TimeToAcquireLock = TimeSpan.FromSeconds(4) }; expected = new StringBuilder(); expected.AppendLine("Lock acquired."); expected.AppendLine("Wait time: About 4 seconds."); Assert.Equal(expected.ToString(), LogAnalysis.Format(log)); log = new SingletonParameterLog { LockAcquired = true, TimeToAcquireLock = TimeSpan.FromSeconds(4), LockDuration = TimeSpan.FromSeconds(2) }; expected = new StringBuilder(); expected.AppendLine("Lock acquired."); expected.AppendLine("Wait time: About 4 seconds."); expected.AppendLine("Lock duration: About 2 seconds."); Assert.Equal(expected.ToString(), LogAnalysis.Format(log)); }