コード例 #1
0
ファイル: Tests.cs プロジェクト: cxsun/logjoint
		static void FindDateBoundTest(ValueBound bound, long dateTicks, 
			string expectedMessage, EntryPartition? searchRangeBegin = null, EntryPartition? searchRangeEnd = null)
		{
			var entry = AzureDiagnosticsUtils.FindDateBound(
				new AzureDiagnosticLogsTableMock()
					.Add(TestEventTimestampFromMinutes(1), "1")
					.Add(TestEventTimestampFromMinutes(1) + 2, "1+2")
					.Add(TestEventTimestampFromMinutes(1) + 2, "1+2.2")
					.Add(TestEventTimestampFromMinutes(1) + 3, "1+3")
					.Add(TestEventTimestampFromMinutes(1) + 10, "1+10")
					.Add(TestEventTimestampFromMinutes(2), "2")
					.Add(TestEventTimestampFromMinutes(3) + 100, "3+100")
					.Add(TestEventTimestampFromMinutes(3) + 200, "3+200")
					.Add(TestEventTimestampFromMinutes(3) + 300, "3+300")
					.Add(TestEventTimestampFromMinutes(3) + 300, "3+300.2")
					.Add(TestEventTimestampFromMinutes(1000) + 10, "1000+10")
					.Add(TestEventTimestampFromMinutes(1000) + 20, "1000+20")
					.Add(TestEventTimestampFromMinutes(100000), "100000")
					.Add(TestEventTimestampFromMinutes(100000) + 100, "100000+100"),
				new DateTime(dateTicks, DateTimeKind.Utc), bound, 
					searchRangeBegin.GetValueOrDefault(EntryPartition.MinValue), 
					searchRangeEnd.GetValueOrDefault(EntryPartition.MaxValue), 
					CancellationToken.None);
			if (expectedMessage == null)
			{
				Assert.IsTrue(!entry.HasValue);
			}
			else
			{
				Assert.IsTrue(entry.HasValue);
				Assert.AreEqual(expectedMessage, (entry.Value.Entry as WADLogsTableEntry).Message);
			}
		}
コード例 #2
0
ファイル: Tests.cs プロジェクト: cxsun/logjoint
		public void FindDateBound_LowerBound_BugFromRealLogs2()
		{
			var tableMock = new AzureDiagnosticLogsTableMock()
					.Add(634929032152764926, "1")
					.Add(634929034677682953, "2")
					.Add(634929034680972605, "3")
					.Add(634931678260882377, "4");
			var bound = AzureDiagnosticsUtils.FindDateBound(tableMock, new DateTime(634929213420972605, DateTimeKind.Utc),
				ValueBound.Lower,
				new EntryPartition(0634929031800000000), new EntryPartition(0634932574800000000), CancellationToken.None);
			Assert.IsTrue(bound.HasValue && (bound.Value.Entry as WADLogsTableEntry).Message == "4");
		}