Exemplo n.º 1
0
 public void Init()
 {
     traditionalClient  = new TraditionalClient("hostname");
     mockAttributeName  = "property";
     mockAttributeName2 = "property2";
     mockAttributeName3 = "property3";
     mockAttributeName4 = "property4";
     mockAttributeName5 = "property5";
     mockid             = new Guid("11111111-2222-3333-4444-555555555555");
     mockid2            = new Guid("11111111-2222-3333-4444-555555555556");
 }
Exemplo n.º 2
0
        public void TestBadHostLoginHandlesException()
        {
            using (var httpTest = new HttpTest())
            {
                httpTest.RespondWith("Call failed. No such host is known POST https://badhost/api/V2/login", 404);

                try
                {
                    TraditionalClient traditionalClientBad = new TraditionalClient("badhost");
                    traditionalClientBad.TryLogin("username", "password");

                    httpTest.ShouldHaveCalled($"https://badhost/api/V2/login")
                    .WithVerb(HttpMethod.Post)
                    .WithContentType("application/json")
                    .WithRequestBody("{\"username\":\"username\",\"password\":\"password\"")
                    .Times(1);
                }
                catch
                {
                    Assert.Fail();
                }
            }
        }