protected void CommonTestFunction(IServiceProvider serviceProvider, Action <TestSqliteContext> databaseInitializationAction) { long id = -1; byte[]? opCounter = null; using (var context = serviceProvider.GetRequiredService <TestSqliteContext>()) { databaseInitializationAction(context); var tmp = new TestRow(); tmp.Status = "Created"; context.Add(tmp); context.SaveChanges(); id = tmp.Id; opCounter = tmp.OpCounter; Assert.AreNotEqual(0, id); Assert.AreNotEqual(-1, id); Assert.AreNotEqual(null, opCounter); } using (var context = serviceProvider.GetRequiredService <TestSqliteContext>()) { var tmp = context.TestRows.First(item => item.Id == id); context.Update(tmp); context.SaveChanges(); Assert.AreNotEqual(opCounter, tmp.OpCounter); } }
public async Task AddOrUpdateMany() { var azureTable = new AzureTable <TestRow>(account, TableName); var row1 = new TestRow { PartitionKey = "partition_key_AddOrUpdateMany", RowKey = "row_key_1_AddOrUpdateMany", Content = "content 1", ETag = "*" }; var row2 = new TestRow { PartitionKey = "partition_key_AddOrUpdateMany", RowKey = "row_key_2_AddOrUpdateMany", Content = "content 2", ETag = "*" }; await azureTable.DeleteAsync(new[] { row1, row2 }); var rowsToDelete = await azureTable.GetByPartitionKeyAsync("partition_key_AddOrUpdateMany"); Assert.AreEqual(0, rowsToDelete.Count()); await azureTable.AddAsync(row1); var actualRows = await azureTable.GetByPartitionKeyAsync("partition_key_AddOrUpdateMany"); Assert.AreEqual(1, actualRows.Count()); row1.Content = "content modified"; await azureTable.AddOrUpdateAsync(new[] { row1, row2 }); var insertedRows = await azureTable.GetByPartitionKeyAsync("partition_key_AddOrUpdateMany"); Assert.AreEqual(2, insertedRows.Count()); TestRow updatedRow = await azureTable.GetByPartitionRowKeyAsync("partition_key_AddOrUpdateMany", row1.RowKey); Assert.IsNotNull(updatedRow); Assert.AreEqual("content modified", updatedRow.Content); }
public void SaveManyAndDeleteMany() { var account = CloudConfiguration.GetStorageAccount("DataConnectionString"); var azureTable = new AzureTable <TestRow>(account, TableName); var row1 = new TestRow { PartitionKey = "partition_key_SaveManyAndDeleteMany", RowKey = "row_key_1_SaveManyAndDeleteMany" }; var row2 = new TestRow { PartitionKey = "partition_key_SaveManyAndDeleteMany", RowKey = "row_key_2_SaveManyAndDeleteMany" }; azureTable.Delete(new[] { row1, row2 }); var rowsToDelete = (from o in azureTable.Query where o.PartitionKey == "partition_key_SaveManyAndDeleteMany" select o).ToList(); Assert.AreEqual(0, rowsToDelete.Count); azureTable.Add(new[] { row1, row2 }); var insertedRows = (from o in azureTable.Query where o.PartitionKey == "partition_key_SaveManyAndDeleteMany" select o).ToList(); Assert.AreEqual(2, insertedRows.Count); azureTable.Delete(new[] { row1, row2 }); var actualRows = (from o in azureTable.Query where o.PartitionKey == "partition_key_SaveManyAndDeleteMany" select o).ToList(); Assert.AreEqual(0, actualRows.Count); }
public async Task GetByPartitionKey_Returns_SpecificEntities() { var azureTable = new AzureTable <TestRow>(account, TableName); var row1 = new TestRow { PartitionKey = "partition_key_1_GetByPartitionKey_Returns_SpecificEntities", RowKey = "row_key_1_GetByPartitionKey_Returns_SpecificEntities", Content = "content 1", ETag = "*" }; var row2 = new TestRow { PartitionKey = "partition_key_2_GetByPartitionKey_Returns_SpecificEntities", RowKey = "row_key_2_GetByPartitionKey_Returns_SpecificEntities", Content = "content 2", ETag = "*" }; var row3 = new TestRow { PartitionKey = "partition_key_2_GetByPartitionKey_Returns_SpecificEntities", RowKey = "row_key_3_GetByPartitionKey_Returns_SpecificEntities", Content = "content 3", ETag = "*" }; await azureTable.DeleteAsync(row1); await azureTable.DeleteAsync(row2); await azureTable.DeleteAsync(row3); await azureTable.AddAsync(row1); await azureTable.AddAsync(row2); await azureTable.AddAsync(row3); var retrievedRows = await azureTable.GetByPartitionKeyAsync("partition_key_2_GetByPartitionKey_Returns_SpecificEntities"); Assert.AreEqual(2, retrievedRows.Count()); Assert.AreEqual(row2.Content, retrievedRows.ToList()[0].Content); }
public Test DevolverPreguntasTest(int idTest, out string msg) { TestRow drTest = ds.Test.FindByIdTest(idTest); if (drTest == null) { msg = "No existe el test"; return(null); } Test nuevoTest = new Test(idTest); List <PreguntasRow> drPreguntas = drTest.GetPreguntasRows().ToList(); List <Pregunta> listPreguntas = (from drpregunta in drPreguntas select new Pregunta(drpregunta.IdPregunta, drpregunta.Enunciado, drpregunta.RespV)).ToList(); if (listPreguntas.Count == 0) { msg = "Este test no tiene preguntas"; return(null); } //foreach (var pregunta in listPreguntas) //{ // nuevoTest.preguntasTest.Add(pregunta); //} nuevoTest.preguntasTest = listPreguntas; msg = ""; return(nuevoTest); }
public async Task AddOrUpdateAddsWhenNotExists() { var account = CloudConfiguration.GetStorageAccount("DataConnectionString"); var azureTable = new AzureTable <TestRow>(account, TableName); var row = new TestRow { PartitionKey = "partition_key_AddOrUpdateAddsWhenNotExists", RowKey = "row_key_AddOrUpdateAddsWhenNotExists", Content = "content" }; await azureTable.DeleteAsync(row); TestRow deletedRow = (await azureTable.GetByRowKeyAsync(row.RowKey)).SingleOrDefault(); Assert.IsNull(deletedRow); await azureTable.AddOrUpdateAsync(row); TestRow savedRow = await azureTable.GetByPartitionRowKeyAsync("partition_key_AddOrUpdateAddsWhenNotExists", row.RowKey); Assert.IsNotNull(savedRow); Assert.AreEqual("content", savedRow.Content); }
public async Task GetByPartitionRowKey_Returns_SpecificEntity() { var azureTable = new AzureTable <TestRow>(account, TableName); var row1 = new TestRow { PartitionKey = "GetByPartitionRowKey_Returns_SpecificEntity", RowKey = "row_key_1_GetByPartitionRowKey_Returns_SpecificEntity", Content = "content 1", ETag = "*" }; var row2 = new TestRow { PartitionKey = "GetByPartitionRowKey_Returns_SpecificEntity", RowKey = "row_key_2_GetByPartitionRowKey_Returns_SpecificEntity", Content = "content 2", ETag = "*" }; var row3 = new TestRow { PartitionKey = "GetByPartitionRowKey_Returns_SpecificEntity", RowKey = "row_key_3_GetByPartitionRowKey_Returns_SpecificEntity", Content = "content 3", ETag = "*" }; await azureTable.DeleteAsync(new[] { row1, row2, row3 }); var rowsToDelete = await azureTable.GetByPartitionKeyAsync("GetByPartitionRowKey_Returns_SpecificEntity"); Assert.AreEqual(0, rowsToDelete.Count()); await azureTable.AddAsync(new[] { row1, row2, row3 }); var retrievedRow = await azureTable.GetByPartitionRowKeyAsync("GetByPartitionRowKey_Returns_SpecificEntity", "row_key_2_GetByPartitionRowKey_Returns_SpecificEntity"); Assert.AreEqual(row2.Content, retrievedRow.Content); }
public void AddOrUpdateMany() { var account = CloudConfiguration.GetStorageAccount("DataConnectionString"); var azureTable = new AzureTable<TestRow>(account, TableName); var row1 = new TestRow { PartitionKey = "partition_key_AddOrUpdateMany", RowKey = "row_key_1_AddOrUpdateMany", Content = "content 1" }; var row2 = new TestRow { PartitionKey = "partition_key_AddOrUpdateMany", RowKey = "row_key_2_AddOrUpdateMany", Content = "content 2" }; azureTable.Delete(new[] { row1, row2 }); var rowsToDelete = (from o in azureTable.Query where o.PartitionKey == "partition_key_AddOrUpdateMany" select o).ToList(); Assert.AreEqual(0, rowsToDelete.Count); azureTable.Add(row1); var actualRows = (from o in azureTable.Query where o.PartitionKey == "partition_key_AddOrUpdateMany" select o).ToList(); Assert.AreEqual(1, actualRows.Count); row1.Content = "content modified"; azureTable.AddOrUpdate(new[] { row1, row2 }); var insertedRows = (from o in azureTable.Query where o.PartitionKey == "partition_key_AddOrUpdateMany" select o).ToList(); Assert.AreEqual(2, insertedRows.Count); TestRow updatedRow = (from o in azureTable.Query where o.RowKey == row1.RowKey && o.PartitionKey == "partition_key_AddOrUpdateMany" && o.Content == "content modified" select o).SingleOrDefault(); Assert.IsNotNull(updatedRow); }
public async Task SaveManyAndDeleteMany() { var azureTable = new AzureTable <TestRow>(account, TableName); var row1 = new TestRow { PartitionKey = "partition_key_SaveManyAndDeleteMany", RowKey = "row_key_1_SaveManyAndDeleteMany", ETag = "*" }; var row2 = new TestRow { PartitionKey = "partition_key_SaveManyAndDeleteMany", RowKey = "row_key_2_SaveManyAndDeleteMany", ETag = "*" }; await azureTable.DeleteAsync(new[] { row1, row2 }); var rowsToDelete = await azureTable.GetByPartitionKeyAsync("partition_key_SaveManyAndDeleteMany"); Assert.AreEqual(0, rowsToDelete.Count()); row1.ETag = string.Empty; row2.ETag = string.Empty; await azureTable.AddAsync(new[] { row1, row2 }); var insertedRows = await azureTable.GetByPartitionKeyAsync("partition_key_SaveManyAndDeleteMany"); Assert.AreEqual(2, insertedRows.Count()); await azureTable.DeleteAsync(new[] { row1, row2 }); var actualRows = await azureTable.GetByPartitionKeyAsync("partition_key_SaveManyAndDeleteMany"); Assert.AreEqual(0, actualRows.Count()); }
public void AddOrUpdateAddsWhenNotExists() { var account = CloudConfiguration.GetStorageAccount("DataConnectionString"); var azureTable = new AzureTable<TestRow>(account, TableName); azureTable.RetryPolicyFactory = new DefaultRetryPolicyFactory(); var row = new TestRow { PartitionKey = "partition_key_AddOrUpdateAddsWhenNotExists", RowKey = "row_key_AddOrUpdateAddsWhenNotExists", Content = "content" }; azureTable.Delete(row); TestRow deletedRow = (from o in azureTable.Query where o.RowKey == row.RowKey select o).SingleOrDefault(); Assert.IsNull(deletedRow); azureTable.AddOrUpdate(row); TestRow savedRow = (from o in azureTable.Query where o.RowKey == row.RowKey && o.PartitionKey == "partition_key_AddOrUpdateAddsWhenNotExists" && o.Content == "content" select o).SingleOrDefault(); Assert.IsNotNull(savedRow); }
public void AddOrUpdateAddsWhenNotExists() { var account = CloudConfiguration.GetStorageAccount("DataConnectionString"); var azureTable = new AzureTable <TestRow>(account, TableName); azureTable.RetryPolicyFactory = new DefaultRetryPolicyFactory(); var row = new TestRow { PartitionKey = "partition_key_AddOrUpdateAddsWhenNotExists", RowKey = "row_key_AddOrUpdateAddsWhenNotExists", Content = "content" }; azureTable.Delete(row); TestRow deletedRow = (from o in azureTable.Query where o.RowKey == row.RowKey select o).SingleOrDefault(); Assert.IsNull(deletedRow); azureTable.AddOrUpdate(row); TestRow savedRow = (from o in azureTable.Query where o.RowKey == row.RowKey && o.PartitionKey == "partition_key_AddOrUpdateAddsWhenNotExists" && o.Content == "content" select o).SingleOrDefault(); Assert.IsNotNull(savedRow); }
public void DeleteAndAddAndGet() { var account = CloudConfiguration.GetStorageAccount("DataConnectionString"); var azureTable = new AzureTable <TestRow>(account, TableName); var row = new TestRow { PartitionKey = "partition_key_DeleteAndAddAndGet", RowKey = "row_key_DeleteAndAddAndGet", Content = "content" }; azureTable.Delete(row); TestRow deletedRow = (from o in azureTable.Query where o.RowKey == row.RowKey select o).SingleOrDefault(); Assert.IsNull(deletedRow); azureTable.Add(row); TestRow savedRow = (from o in azureTable.Query where o.RowKey == row.RowKey && o.PartitionKey == "partition_key_DeleteAndAddAndGet" && o.Content == "content" select o).SingleOrDefault(); Assert.IsNotNull(savedRow); azureTable.Delete(row); TestRow actualRow = (from o in azureTable.Query where o.RowKey == row.RowKey select o).SingleOrDefault(); Assert.IsNull(actualRow); }
public async Task AddOrUpdateUpdatesWhenExists() { var azureTable = new AzureTable <TestRow>(account, TableName); var row = new TestRow { PartitionKey = "partition_key_AddOrUpdateUpdatesWhenExists", RowKey = "row_key_AddOrUpdateUpdatesWhenExists", Content = "content" }; await azureTable.DeleteAsync(row); TestRow deletedRow = (await azureTable.GetByRowKeyAsync(row.RowKey)).SingleOrDefault(); Assert.IsNull(deletedRow); await azureTable.AddAsync(row); TestRow savedRow = await azureTable.GetByPartitionRowKeyAsync("partition_key_AddOrUpdateUpdatesWhenExists", row.RowKey); Assert.IsNotNull(savedRow); Assert.AreEqual("content", savedRow.Content); row.Content = "content modified"; await azureTable.AddOrUpdateAsync(row); TestRow updatedRow = await azureTable.GetByPartitionRowKeyAsync("partition_key_AddOrUpdateUpdatesWhenExists", row.RowKey); Assert.IsNotNull(updatedRow); Assert.AreEqual("content modified", updatedRow.Content); }
public async Task DeleteAndAddAndGet() { var azureTable = new AzureTable <TestRow>(account, TableName); var row = new TestRow { PartitionKey = "partition_key_DeleteAndAddAndGet", RowKey = "row_key_DeleteAndAddAndGet", Content = "content" }; await azureTable.DeleteAsync(row); TestRow deletedRow = (await azureTable.GetByRowKeyAsync(row.RowKey)).SingleOrDefault(); Assert.IsNull(deletedRow); await azureTable.AddAsync(row); TestRow savedRow = await azureTable.GetByPartitionRowKeyAsync(row.PartitionKey, row.RowKey); Assert.IsNotNull(savedRow); Assert.AreEqual("content", savedRow.Content); await azureTable.DeleteAsync(row); TestRow actualRow = (await azureTable.GetByRowKeyAsync(row.RowKey)).SingleOrDefault(); Assert.IsNull(actualRow); }
static void Main(string[] args) { var testRow = new TestRow(); string expressionString = "r.Field[\"ColumnA\"] * r.Field[\"ColumnB\"]"; var parameter = Expression.Parameter(typeof(TestRow), "r"); var lambdaET = System.Linq.Dynamic.DynamicExpression.ParseLambda(new[] { parameter }, typeof(float), expressionString); var result = lambdaET.Compile().DynamicInvoke(testRow); Console.WriteLine(result); Console.ReadLine(); }
public object RowGet() { var row = new TestRow() { ID = 777, Name = "Test Name", Date = DateTime.Now, Status = TestStatus.Ok, Span = TimeSpan.FromSeconds(1) }; return(row); }
private int TestRow([NotNull] TestRow testRow, int occurance, [NotNull] ContainerTest containerTest, [NotNull] ICollection <ContainerTest> failedTests, out bool applicable) { applicable = true; IDataReference dataReference = testRow.DataReference; try { return(dataReference.Execute(containerTest, occurance, out applicable)); } catch (TestException e) { _msg.Error(string.Format("Container test execution failed: {0}", e.Message), e); failedTests.Add(containerTest); ReportErrorForFailedTest(containerTest, dataReference, string.Format("Test failed: {0}", e.Message)); return(0); } catch (TestRowException e) { _msg.Error(string.Format("Container test execution failed: {0}", e.Message), e); ReportErrorForFailedTest(containerTest, dataReference, string.Format("Test failed for row: {0}", e.Message)); return(0); } catch (Exception e) { _msg.Error(string.Format("Container test execution failed: {0}", e.Message), e); var rowReference = dataReference as RowReference; if (rowReference != null) { throw new TestContainerException(containerTest, rowReference.Row, e); } throw new TestContainerException(containerTest, dataReference.Extent, e); } }
public void DeleteAndAddAndGet() { var account = CloudConfiguration.GetStorageAccount("DataConnectionString"); var azureTable = new AzureTable <TestRow>(account, TableName); var row = new TestRow { PartitionKey = "partition_key_DeleteAndAddAndGet", RowKey = "row_key_DeleteAndAddAndGet", Content = "content" }; azureTable.Delete(row); TableQuery <TestRow> query = new TableQuery <TestRow>().Where(TableQuery.GenerateFilterCondition(("RowKey"), QueryComparisons.Equal, row.RowKey)); var deletedRow = azureTable.AzureCloudTable.ExecuteQuery(query).SingleOrDefault(); //TestRow deletedRow = azureTable.AzureCloudTable.ExecuteQuery( (from o in azureTable.Query // where o.RowKey == row.RowKey // select o).SingleOrDefault(); Assert.IsNull(deletedRow); azureTable.Add(row); TableQuery <TestRow> query1 = new TableQuery <TestRow>().Where ( TableQuery.GenerateFilterCondition(("RowKey"), QueryComparisons.Equal, row.RowKey) + TableQuery.GenerateFilterCondition(("PartitionKey"), QueryComparisons.Equal, "partition_key_DeleteAndAddAndGet") ); var tableSavedResult = azureTable.AzureCloudTable.Execute(TableOperation.Retrieve("partition_key_DeleteAndAddAndGet", row.RowKey)); //TestRow savedRow = (TestRow)tableSavedResult.Result; //var savedRow = azureTable.AzureCloudTable.ExecuteQuery(query1).SingleOrDefault(); //TestRow savedRow = (from o in azureTable.Query // where o.RowKey == row.RowKey && // o.PartitionKey == "partition_key_DeleteAndAddAndGet" && // o.Content == "content" // select o).SingleOrDefault(); Assert.IsNotNull(tableSavedResult.Result); azureTable.Delete(row); var tableActualResult = azureTable.AzureCloudTable.Execute(TableOperation.Retrieve("*", row.RowKey)); //TestRow actualRow = (TestRow)tableActualResult.Result; //TestRow actualRow = (from o in azureTable.Query // where o.RowKey == row.RowKey // select o).SingleOrDefault(); Assert.IsNull(tableActualResult.Result); }
public Categoria DevolverTestsCategoria(int idCategoria, out string msg) { CategoriasRow drCategoria = ds.Categorias.FindByIdCategoria(idCategoria); if (drCategoria == null) { msg = "No existe la categoría"; return(null); } List <CategoriasTestsRow> drCategoriasTest = drCategoria.GetCategoriasTestsRows().ToList(); var listTest = (from drcatTest in drCategoriasTest select new Test(drcatTest.IdTest, drcatTest.TestRow.Descripcion)).ToList(); if (listTest.Count == 0) { msg = "Esta categoría no tiene tests"; return(null); } foreach (var test in listTest) { TestRow drTest = ds.Test.FindByIdTest(test.idTest); List <PreguntasRow> drPreguntas = drTest.GetPreguntasRows().ToList(); List <Pregunta> listPreguntas = (from drPregunta in drPreguntas select new Pregunta(drPregunta.IdPregunta, drPregunta.Enunciado, drPregunta.RespV)).ToList(); if (listPreguntas.Count != 0) { foreach (var pregunta in listPreguntas) { test.preguntasTest.Add(pregunta); } } } Categoria nuevaCategoria = new Categoria(drCategoria.IdCategoria, drCategoria.Descripcion, listTest); msg = ""; return(nuevaCategoria); }
public void AddOrUpdateMany() { var account = CloudConfiguration.GetStorageAccount("DataConnectionString"); var azureTable = new AzureTable <TestRow>(account, TableName); var row1 = new TestRow { PartitionKey = "partition_key_AddOrUpdateMany", RowKey = "row_key_1_AddOrUpdateMany", Content = "content 1" }; var row2 = new TestRow { PartitionKey = "partition_key_AddOrUpdateMany", RowKey = "row_key_2_AddOrUpdateMany", Content = "content 2" }; azureTable.Delete(new[] { row1, row2 }); var rowsToDelete = (from o in azureTable.Query where o.PartitionKey == "partition_key_AddOrUpdateMany" select o).ToList(); Assert.AreEqual(0, rowsToDelete.Count); azureTable.Add(row1); var actualRows = (from o in azureTable.Query where o.PartitionKey == "partition_key_AddOrUpdateMany" select o).ToList(); Assert.AreEqual(1, actualRows.Count); row1.Content = "content modified"; azureTable.AddOrUpdate(new[] { row1, row2 }); var insertedRows = (from o in azureTable.Query where o.PartitionKey == "partition_key_AddOrUpdateMany" select o).ToList(); Assert.AreEqual(2, insertedRows.Count); TestRow updatedRow = (from o in azureTable.Query where o.RowKey == row1.RowKey && o.PartitionKey == "partition_key_AddOrUpdateMany" && o.Content == "content modified" select o).SingleOrDefault(); Assert.IsNotNull(updatedRow); }
public void Schema_FromMap() { var src = new TestRow().Schema; var json = src.ToJSON(); var trg = Schema.FromJSON(JSONReader.DeserializeDataObject(json) as JSONDataMap, true); Assert.IsTrue(trg.Name.StartsWith("JSON")); Assert.IsTrue(trg.ReadOnly); Assert.AreEqual(trg.FieldDefs.Count(), src.FieldDefs.Count()); Assert.AreEqual(trg["BoolField"].Type, typeof(Boolean?)); Assert.AreEqual(trg["CharField"].Type, typeof(Char?)); Assert.AreEqual(trg["DateTimeField"].Type, typeof(DateTime?)); Assert.AreEqual(trg["GDIDField"].Type, typeof(string)); Assert.AreEqual(trg["ByteField"].Type, typeof(Int32?)); Assert.AreEqual(trg["SByteField"].Type, typeof(Int32?)); Assert.AreEqual(trg["ShortField"].Type, typeof(Int32?)); Assert.AreEqual(trg["Int16Field"].Type, typeof(Int32?)); Assert.AreEqual(trg["UShortField"].Type, typeof(Int32?)); Assert.AreEqual(trg["UInt16Field"].Type, typeof(Int32?)); Assert.AreEqual(trg["IntField"].Type, typeof(Int32?)); Assert.AreEqual(trg["Int32Field"].Type, typeof(Int32?)); Assert.AreEqual(trg["UIntField"].Type, typeof(Int64?)); Assert.AreEqual(trg["UInt32Field"].Type, typeof(Int64?)); Assert.AreEqual(trg["LongField"].Type, typeof(Int64?)); Assert.AreEqual(trg["Int64Field"].Type, typeof(Int64?)); Assert.AreEqual(trg["ULongField"].Type, typeof(UInt64?)); Assert.AreEqual(trg["UInt64Field"].Type, typeof(UInt64?)); Assert.AreEqual(trg["FloatField"].Type, typeof(Double?)); Assert.AreEqual(trg["SingleField"].Type, typeof(Double?)); Assert.AreEqual(trg["DoubleField"].Type, typeof(Double?)); Assert.AreEqual(trg["DecimalField"].Type, typeof(Decimal?)); Assert.AreEqual(trg["FieldWithAttrs"].Attrs, src["FieldWithAttrs"].Attrs); }
public void GroupPropertyValueAndDistinct([IncludeDataSources(TestProvName.AllSQLite)] string context) { var testData = TestRow.MakeTestData(); using (var db = GetDataContext(context)) using (var table = db.CreateLocalTable(testData)) { var query = from row in table group row.LinkCol by row.GroupCol into grp select new { grp.Key, c1 = grp.Count(), c2 = grp.Distinct().Count() }; var expected = from row in testData group row.LinkCol by row.GroupCol into grp select new { grp.Key, c1 = grp.Count(), c2 = grp.Distinct().Count() }; Assert.AreEqual(expected, query); } }
public void WriteXmlThrowsIfRowIsInvalid() { using (var writer = new TestXmlWriter()) { var row = new TestRow { Exception = new Exception() }; try { new ResultSetRowSerializer().Serialize(writer.Writer, row, new ResultSetRowSerializerContext { Schema = new ResultSetSchema() }); } catch (Exception ex) { Assert.AreSame(typeof(InvalidOperationException), ex.GetType()); Assert.AreSame(row.Exception, ex.InnerException); return; } Assert.Fail("Expected exception not thrown"); } }
public object RowGet() { var row = new TestRow(){ ID = 777, Name = "Test Name", Date = DateTime.Now, Status = TestStatus.Ok, Span = TimeSpan.FromSeconds(1) }; return row; }
public void SaveManyAndDeleteMany() { var account = CloudConfiguration.GetStorageAccount("DataConnectionString"); var azureTable = new AzureTable<TestRow>(account, TableName); var row1 = new TestRow { PartitionKey = "partition_key_SaveManyAndDeleteMany", RowKey = "row_key_1_SaveManyAndDeleteMany" }; var row2 = new TestRow { PartitionKey = "partition_key_SaveManyAndDeleteMany", RowKey = "row_key_2_SaveManyAndDeleteMany" }; azureTable.Delete(new[] { row1, row2 }); var rowsToDelete = (from o in azureTable.Query where o.PartitionKey == "partition_key_SaveManyAndDeleteMany" select o).ToList(); Assert.AreEqual(0, rowsToDelete.Count); azureTable.Add(new[] { row1, row2 }); var insertedRows = (from o in azureTable.Query where o.PartitionKey == "partition_key_SaveManyAndDeleteMany" select o).ToList(); Assert.AreEqual(2, insertedRows.Count); azureTable.Delete(new[] { row1, row2 }); var actualRows = (from o in azureTable.Query where o.PartitionKey == "partition_key_SaveManyAndDeleteMany" select o).ToList(); Assert.AreEqual(0, actualRows.Count); }
public object RowDifferentFieldTypes(TestRow row) { return(row);// new JSONResult(row, JSONWritingOptions.CompactRowsAsMap); }
public object RowAndPrimitive_RowMiddle(int n, TestRow row, string s) { row.ID = n; row.Name = s; return(row);//new JSONResult(row, JSONWritingOptions.CompactRowsAsMap); }
public object RowSet(TestRow row) { row.Date = DateTime.Now; return(row); }
public string RowDifferentFieldTypes(TestRow row) { return row.ToJSON(JSONWritingOptions.CompactRowsAsMap); }
public string RowDifferentFieldTypes(TestRow row) { return(row.ToJSON(JSONWritingOptions.CompactRowsAsMap)); }
public void DeleteAndAddAndGet() { var account = CloudConfiguration.GetStorageAccount("DataConnectionString"); var azureTable = new AzureTable<TestRow>(account, TableName); var row = new TestRow { PartitionKey = "partition_key_DeleteAndAddAndGet", RowKey = "row_key_DeleteAndAddAndGet", Content = "content" }; azureTable.Delete(row); TestRow deletedRow = (from o in azureTable.Query where o.RowKey == row.RowKey select o).SingleOrDefault(); Assert.IsNull(deletedRow); azureTable.Add(row); TestRow savedRow = (from o in azureTable.Query where o.RowKey == row.RowKey && o.PartitionKey == "partition_key_DeleteAndAddAndGet" && o.Content == "content" select o).SingleOrDefault(); Assert.IsNotNull(savedRow); azureTable.Delete(row); TestRow actualRow = (from o in azureTable.Query where o.RowKey == row.RowKey select o).SingleOrDefault(); Assert.IsNull(actualRow); }
public object RowDifferentFieldTypes(TestRow row) { return row;// new JSONResult(row, JSONWritingOptions.CompactRowsAsMap); }
public object RowAndPrimitive_RowMiddle(int n, TestRow row, string s) { row.ID = n; row.Name = s; return row;//new JSONResult(row, JSONWritingOptions.CompactRowsAsMap); }
public TestRowChangeEvent(TestRow row, global::System.Data.DataRowAction action) { this.eventRow = row; this.eventAction = action; }
public string RowAndPrimitive_RowMiddle(int n, TestRow row, string s) { row.ID = n; row.Name = s; return row.ToJSON(JSONWritingOptions.CompactRowsAsMap); }
public object RowSet(TestRow row) { row.Date = DateTime.Now; return row; }
public string RowAndPrimitive_RowMiddle(int n, TestRow row, string s) { row.ID = n; row.Name = s; return(row.ToJSON(JSONWritingOptions.CompactRowsAsMap)); }