예제 #1
0
파일: Tests.cs 프로젝트: cxsun/logjoint
		public void FindLastMessage_LastMessageIsAfterNow()
		{
			var lastEntryPK = AzureDiagnosticsUtils.FindLastMessagePartitionKey(
				new AzureDiagnosticLogsTableMock().Add(TestEventTimestampFromMinutes(1), "hey").Add(TestEventTimestampFromMinutes(10), "there"),
				new DateTime(TestEventTimestampFromMinutes(7), DateTimeKind.Utc));
			Assert.AreEqual(AzureDiagnosticsUtils.EventTickCountToEventPartitionKey(TestEventTimestampFromMinutes(10)), lastEntryPK.ToString());
		}
예제 #2
0
파일: Tests.cs 프로젝트: cxsun/logjoint
		public void EventTickCountToEventPartitionKeyTest()
		{
			// sample numbers are taken from read WADLogsTable

			Assert.AreEqual("0634923055200000000", AzureDiagnosticsUtils.EventTickCountToEventPartitionKey(634923055356353096));
			Assert.AreEqual("0634904775000000000", AzureDiagnosticsUtils.EventTickCountToEventPartitionKey(634904775152901748));
			Assert.AreEqual("0634903933800000000", AzureDiagnosticsUtils.EventTickCountToEventPartitionKey(634903934382982291));
		}
예제 #3
0
파일: Tests.cs 프로젝트: cxsun/logjoint
		public void FindLastMessage_ManyMessagesAtTheSameSecond()
		{
			var lastEntryPK = AzureDiagnosticsUtils.FindLastMessagePartitionKey(
				new AzureDiagnosticLogsTableMock()
					.Add(TestEventTimestampFromMinutes(2), "hey")
					.Add(TestEventTimestampFromMinutes(9), "there")
					.Add(TestEventTimestampFromMinutes(9)+1, "there2")
					.Add(TestEventTimestampFromMinutes(9)+2, "there3"),
				new DateTime(TestEventTimestampFromMinutes(15), DateTimeKind.Utc));
			Assert.AreEqual(AzureDiagnosticsUtils.EventTickCountToEventPartitionKey(TestEventTimestampFromMinutes(9)), lastEntryPK.ToString());
		}
예제 #4
0
파일: Tests.cs 프로젝트: cxsun/logjoint
			static WADLogsTableEntry MakeWADEntry(KeyValuePair<long, string> entry)
			{
				if (entry.Value == null)
					return null;
				return new WADLogsTableEntry()
				{
					PartitionKey = AzureDiagnosticsUtils.EventTickCountToEventPartitionKey(entry.Key),
					EventTickCount = entry.Key,
					Timestamp = new DateTime(entry.Key, DateTimeKind.Utc),
					Message = entry.Value
				};
			}
예제 #5
0
파일: Tests.cs 프로젝트: cxsun/logjoint
			public IEnumerable<AzureDiagnosticLogEntry> GetEntriesInRange(string beginPartitionKey, string endPartitionKey, int? limit)
			{
				EnsureCompleted();
				var x =
					from entry in entries
					let pk = AzureDiagnosticsUtils.EventTickCountToEventPartitionKey(entry.Key)
					where string.Compare(pk, beginPartitionKey) >= 0 && string.Compare(pk, endPartitionKey) < 0
					select MakeWADEntry(entry);
				if (limit != null)
					x = x.Take(limit.Value);
				return x;
			}
예제 #6
0
파일: Tests.cs 프로젝트: cxsun/logjoint
			public AzureDiagnosticLogEntry GetFirstEntryOlderThan(string partitionKey)
			{
				EnsureCompleted();
				return MakeWADEntry(entries.FirstOrDefault(entry => 
					string.Compare(AzureDiagnosticsUtils.EventTickCountToEventPartitionKey(entry.Key), partitionKey) > 0));
			}