// [TestMethod] public async Task TestMethod20() { // log to both console and custom trace source sink Log.Logger = new LoggerConfiguration() .WriteTo.LiterateConsole(outputTemplate: "{Timestamp:HH:MM} [{Level}] ({Name:l}){NewLine} {Message}{NewLine}{Exception}") .WriteTo.TraceSource(traceSourceName: "Blabal") .MinimumLevel.Verbose() .CreateLogger(); // var a = SerilogLogProvider.IsLoggerAvailable; // LogProvider.SetCurrentLogProvider() var a = new Test6Context(CloudStorageAccount.Parse(File.ReadAllText(@"c:\dev\teststorage.txt"))); var time = DateTimeOffset.UtcNow; var id = Guid.NewGuid(); var element = new TimeEntity { Id1 = new Guid(), Id2 = id, Time = time }; a.Entities.Add(element); await a.SaveChangesAsync(); //var aaa = await a.Entities.ToListAsync(); //var aa = await a.Entities.FirstAsync(); //var b = a.Entities.First(); var c = new Guid(); // var entities = await a.Entities.Where(k => k.Id1 == c).ToListAsync(); var query = a.Entities.Where(k => k.Id1 == c && k.Time == time); var filter = query.TranslateQuery(); var single = await query.SingleAsync(); Assert.AreEqual(element.Id1, single.Id1); Assert.AreEqual(element.Id2, single.Id2); Assert.AreEqual(element.Time, single.Time); }//.ToString()
public void TestMethod2() { var a = new Test6Context(CloudStorageAccount.DevelopmentStorageAccount); Table.ClearInitializer<Test6Context>(); var time = DateTimeOffset.Parse("2015-11-18T18:34:05.0630931"); var id = "98DEA3AE-0D3D-44F7-BD12-B69F125362F5"; var id2 = new Guid("98DEA3AE-0D3D-44F7-BD12-B69F125362F5"); var query = a.Entities.Where(k => k.Id1 == new Guid(id) && k.Time == time && k.Id2 == id2); var filter = query.TranslateQuery(); var expected = "PartitionKey ge '98dea3ae-0d3d-44f7-bd12-b69f125362f5__02519544327000000000' and PartitionKey lt '98dea3ae-0d3d-44f7-bd12-b69f125362f5__02519544327000000001' and RowKey ge '98dea3ae-0d3d-44f7-bd12-b69f125362f5' and RowKey lt '98dea3ae-0d3d-44f7-bd12-b69f125362f6' and Time eq datetime'2015-11-18T18:34:05.0630931'"; // Not working yet // Assert.AreEqual(expected, filter.FilterString); }