Beispiel #1
0
        public HttpResponseMessage Post([FromUri] string alias, [FromBody] MockAntiAffinityPolicy policy)
        {
            policy.id = Guid.NewGuid().ToString();
            Users.ByAccountAlias[alias].AntiAffinityPolicies.Add(policy.id, policy);

            return(Request.CreateResponse(HttpStatusCode.OK, policy));
        }
Beispiel #2
0
        public HttpResponseMessage Put([FromUri] string alias, [FromUri] string id, [FromBody] MockAntiAffinityPolicy policy)
        {
            var result = Users.ByAccountAlias[alias].AntiAffinityPolicies[id];

            result.name = policy.name;

            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }
        private void AddPolicy(string name)
        {
            var policy = new MockAntiAffinityPolicy
            {
                id = Guid.NewGuid().ToString(),
                name = name,
                location = "WA1"
            };

            CurrentUser.AntiAffinityPolicies.Add(policy.id, policy);
        }
 private void AssertPoliciesEqual(AntiAffinityPolicy expected, MockAntiAffinityPolicy actual)
 {
     Assert.AreEqual(expected.Id, actual.id);
     Assert.AreEqual(expected.Name, actual.name);
     Assert.AreEqual(expected.Location, actual.location);
 }