public void TableBatchAddQueryAndOneMoreOperationShouldThrow() { TableBatchOperation batch = new TableBatchOperation(); TableOperation operation = TableOperation.Retrieve("foo", "bar"); try { batch.Add(operation); Assert.IsTrue(batch.Contains(operation)); batch.Add(TableOperation.Insert(GenerateRandomEntity("foo"))); Assert.Fail(); } catch (ArgumentException) { // no op } catch (Exception) { Assert.Fail(); } batch.Clear(); Assert.IsFalse(batch.Contains(operation)); try { batch.Add(TableOperation.Insert(GenerateRandomEntity("foo"))); batch.Add(TableOperation.Retrieve("foo", "bar")); Assert.Fail(); } catch (ArgumentException) { // no op } catch (Exception) { Assert.Fail(); } batch.Clear(); try { batch.Add(TableOperation.Retrieve("foo", "bar")); batch.Insert(0, TableOperation.Insert(GenerateRandomEntity("foo"))); Assert.Fail(); } catch (ArgumentException) { // no op } catch (Exception) { Assert.Fail(); } try { batch.Insert(0, TableOperation.Insert(GenerateRandomEntity("foo"))); batch.Insert(0, TableOperation.Retrieve("foo", "bar")); Assert.Fail(); } catch (ArgumentException) { // no op } catch (Exception) { Assert.Fail(); } }
public void TableBatchAddQueryAndOneMoreOperationShouldThrow() { TableBatchOperation batch = new TableBatchOperation(); TableOperation operation = TableOperation.Retrieve <DynamicReplicatedTableEntity>("foo", "bar"); try { batch.Add(operation); Assert.IsTrue(batch.Contains(operation)); batch.Add(TableOperation.Insert(GenerateRandomEnitity("foo"))); Assert.Fail(); } catch (ArgumentException) { // no op } catch (Exception) { Assert.Fail(); } batch.Clear(); Assert.IsFalse(batch.Contains(operation)); try { batch.Add(TableOperation.Insert(GenerateRandomEnitity("foo"))); batch.Add(TableOperation.Retrieve <DynamicReplicatedTableEntity>("foo", "bar")); Assert.Fail(); } catch (ArgumentException) { // no op } catch (Exception) { Assert.Fail(); } batch.Clear(); try { batch.Add(TableOperation.Retrieve <DynamicReplicatedTableEntity>("foo", "bar")); batch.Insert(0, TableOperation.Insert(GenerateRandomEnitity("foo"))); Assert.Fail(); } catch (ArgumentException) { // no op } catch (Exception) { Assert.Fail(); } try { batch.Insert(0, TableOperation.Insert(GenerateRandomEnitity("foo"))); batch.Insert(0, TableOperation.Retrieve <DynamicReplicatedTableEntity>("foo", "bar")); Assert.Fail(); } catch (ArgumentException) { // no op } catch (Exception) { Assert.Fail(); } }