public void TestV2Fail_V1Success() { // Arrange EC2Plugin ec2_plugin = new MockEC2Plugin(failV1: false, failV2: true); IDictionary <string, object> context = new Dictionary <string, object>(); // Act bool ret = ec2_plugin.TryGetRuntimeContext(out context); // Assert Assert.IsTrue(ret); Assert.AreEqual(4, context.Count); object instance_id = ""; context.TryGetValue("instance_id", out instance_id); Assert.AreEqual("i-07a181803de94c477", instance_id.ToString()); object availability_zone = ""; context.TryGetValue("availability_zone", out availability_zone); Assert.AreEqual("us-west-2a", availability_zone.ToString()); object instance_size = ""; context.TryGetValue("instance_size", out instance_size); Assert.AreEqual("t2.xlarge", instance_size.ToString()); object ami_id = ""; context.TryGetValue("ami_id", out ami_id); Assert.AreEqual("ami-03cca83dd001d4d11", ami_id.ToString()); }
public void TestV2Fail_V1Fail() { // Arrange EC2Plugin ec2_plugin = new MockEC2Plugin(failV1: true, failV2: true); IDictionary <string, object> context = new Dictionary <string, object>(); // Act bool ret = ec2_plugin.TryGetRuntimeContext(out context); // Assert Assert.IsFalse(ret); Assert.AreEqual(0, context.Count); }