public void Resolve() { DiSetup.Tests(); TypedTestClient client = DiHelper.GetService <TypedTestClient>(new Uri("http://baseUri")); Assert.IsNotNull(client); }
public void DeleteAsyncNotFound() { DiSetup.Tests(); var handlerMock = this.messageHandlerMockFaker(new HttpResponseMessage() { StatusCode = HttpStatusCode.NotFound }); TypedTestClient client = DiHelper.GetService <TypedTestClient>(new Uri("http://baseUri"), handlerMock.Object); bool result = client.DeleteAsync(1).GetAwaiter().GetResult(); Assert.IsNotNull(result); Assert.AreEqual(false, result); }
public void GetAsync() { DiSetup.Tests(); var handlerMock = this.messageHandlerMockFaker(new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, Content = this.getContent <ValueObject <string> >(new ValueObject <string>("Hello World")), }); TypedTestClient client = DiHelper.GetService <TypedTestClient>(new Uri("http://baseUri"), handlerMock.Object); ValueObject <string> result = client.GetAsync(1).GetAwaiter().GetResult(); Assert.IsNotNull(result); Assert.AreEqual("Hello World", result.Value); }
public void CreateOrUpdateAsync() { DiSetup.Tests(); var handlerMock = this.messageHandlerMockFaker(new HttpResponseMessage() { StatusCode = HttpStatusCode.Accepted }); var newItem = new ValueObject <string>("SomeThing"); TypedTestClient client = DiHelper.GetService <TypedTestClient>(new Uri("http://baseUri"), handlerMock.Object); bool result = client.CreateOrUpdateAsync(newItem).GetAwaiter().GetResult(); Assert.IsNotNull(result); Assert.AreEqual(true, result); }