public void Construct() { var batch = new DeleteBatch(new[] { "a", "b" }); var request = new DeleteObjectBatchRequest("s3.amazon.com", "bucket", batch); Assert.Equal("https://s3.amazon.com/bucket?delete", request.RequestUri.ToString()); Assert.Equal(HttpMethod.Post, request.Method); }
public void Test() { var batch = new DeleteBatch("1", "2"); Assert.Equal(expected: @"<Delete> <Object> <Key>1</Key> </Object> <Object> <Key>2</Key> </Object> </Delete>", actual: batch.ToXmlString()); }
public static object UpdateData(int areaid, int ruleid, int areaInOut, string tagIDs, bool forAll) { int[] _tagIDs = new int[0]; if (tagIDs.Trim().Length > 0) { _tagIDs = Array.ConvertAll <string, int>(tagIDs.Split(new char[] { ',' }), delegate(string x) { return(Convert.ToInt32(x)); }); } if (ruleid == 0) { Summer.Transaction t1 = new Transaction(); try { Model.plugin_AreaWarningRule rule1 = new plugin_AreaWarningRule(); rule1.AreaEventType = (byte)areaInOut; rule1.AreaId = areaid; rule1.EnableToAllTags = forAll; t1.SaveEntity(rule1); ruleid = rule1.Id; if (!forAll) { foreach (int tagid in _tagIDs) { plugin_AreaWarningRuleCoverage rc1 = new plugin_AreaWarningRuleCoverage(); rc1.RuleId = rule1.Id; rc1.TagId = tagid; t1.InsertEntity(rc1); } } } catch (Exception e1) { t1.Rollback(); throw e1; } t1.Commit(); } else { Summer.Transaction t2 = new Transaction(); try { Model.plugin_AreaWarningRule rule2 = new plugin_AreaWarningRule(); rule2.Id = ruleid; rule2.AreaEventType = (byte)areaInOut; rule2.AreaId = areaid; rule2.EnableToAllTags = forAll; t2.SaveEntity(rule2); DeleteBatch <plugin_AreaWarningRuleCoverage> delBat = new DeleteBatch <plugin_AreaWarningRuleCoverage>(); delBat.Where = (new Condition <plugin_AreaWarningRuleCoverage>()).EqualTo(plugin_AreaWarningRuleCoverage.__RuleId, ruleid); t2.ExecuteDeleteBatch(delBat); if (!forAll) { foreach (int tagid in _tagIDs) { plugin_AreaWarningRuleCoverage rc1 = new plugin_AreaWarningRuleCoverage(); rc1.RuleId = rule2.Id; rc1.TagId = tagid; t2.InsertEntity(rc1); } } } catch (Exception e2) { t2.Rollback(); throw e2; } t2.Commit(); } return(new { RuleID = ruleid }); }