public void SetUp() { client = new Aliyun.MNS.MNSClient(_accessKeyId, _secretAccessKey, _endpoint); client.CreateQueue("UTQueue"); try { client.DeleteQueue("UTQueue2"); } catch (Exception) { // do nothing } }
public void SetUp() { var config = Newtonsoft.Json.JsonConvert.DeserializeObject <ConfigModel>(File.ReadAllText(@"E:\MNS.json")); _accessKeyId = config.AccessKeyId; _secretAccessKey = config.AccessKey; _endpoint = config.EndPoint; client = new MNSClient(_accessKeyId, _secretAccessKey, _endpoint); client.CreateQueue("UTQueue"); try { client.DeleteQueue("UTQueue2"); } catch (Exception) { // do nothing } }
public void SetAttributesTest() { Queue queue = client.GetNativeQueue("UTQueue"); var resp = queue.GetAttributes(); var originalLoggingEnabled = resp.Attributes.LoggingEnabled; QueueAttributes qa = new QueueAttributes(); queue.SetAttributes(qa); resp = queue.GetAttributes(); Assert.AreEqual(originalLoggingEnabled, resp.Attributes.LoggingEnabled); qa = new QueueAttributes() { LoggingEnabled = false }; queue.SetAttributes(qa); resp = queue.GetAttributes(); Assert.AreEqual(false, resp.Attributes.LoggingEnabled); qa = new QueueAttributes(); queue.SetAttributes(qa); resp = queue.GetAttributes(); Assert.AreEqual(false, resp.Attributes.LoggingEnabled); qa = new QueueAttributes() { LoggingEnabled = true }; queue.SetAttributes(qa); resp = queue.GetAttributes(); Assert.AreEqual(true, resp.Attributes.LoggingEnabled); qa = new QueueAttributes(); queue.SetAttributes(qa); resp = queue.GetAttributes(); Assert.AreEqual(true, resp.Attributes.LoggingEnabled); qa = new QueueAttributes() { LoggingEnabled = true }; var req = new CreateQueueRequest() { QueueName = "UTQueue2", Attributes = qa }; Queue queue2 = client.CreateQueue(req); resp = queue2.GetAttributes(); Assert.AreEqual(true, resp.Attributes.LoggingEnabled); client.DeleteQueue("UTQueue2"); qa = new QueueAttributes() { LoggingEnabled = false }; req = new CreateQueueRequest() { QueueName = "UTQueue2", Attributes = qa }; queue2 = client.CreateQueue(req); resp = queue2.GetAttributes(); Assert.AreEqual(false, resp.Attributes.LoggingEnabled); }