public void DeleteByAuthorId_VerifySendRequestCalled() { var fakeConfig = MakeFakeConfig(); var mockWebApiDataAccess = new MockIWebApiDataAccess(); var webApiAdapter = new BlogPostWebApiAdapter(fakeConfig, mockWebApiDataAccess); var param_id = new BlogPostFactory().Create().AuthorId; mockWebApiDataAccess.StubSendRequest(MakeHttpResponseMessage(HttpStatusCode.OK)); webApiAdapter.DeleteAllByAuthorId(param_id); mockWebApiDataAccess.VerifySendRequestCalled(1); }
public void Add_VerifySendRequestCalled() { var fakeConfig = MakeFakeConfig(); var mockWebApiDataAccess = new MockIWebApiDataAccess(); var webApiAdapter = new BlogPostWebApiAdapter(fakeConfig, mockWebApiDataAccess); var param_entity = new BlogPostFactory().Create(); mockWebApiDataAccess.StubSendRequest(MakeHttpResponseMessage(HttpStatusCode.OK)); webApiAdapter.Add(param_entity); mockWebApiDataAccess.VerifySendRequestCalled(1); }
public void GetById_VerifySendRequestCalled() { var fakeConfig = MakeFakeConfig(); var mockWebApiDataAccess = new MockIWebApiDataAccess(); var webApiAdapter = new BlogPostWebApiAdapter(fakeConfig, mockWebApiDataAccess); var param_id = new BlogPostFactory().Create().PostId; var stub_expectedBlogPost = new BlogPostFactory().Create(); var stub_response = MakeHttpResponseMessage(HttpStatusCode.OK); stub_response.Content = new StringContent(JsonConvert.SerializeObject(stub_expectedBlogPost)); mockWebApiDataAccess.StubSendRequest(stub_response); webApiAdapter.GetById(param_id); mockWebApiDataAccess.VerifySendRequestCalled(1); }
public void ListByAuthorId_VerifySendRequestCalled() { var fakeConfig = MakeFakeConfig(); var mockWebApiDataAccess = new MockIWebApiDataAccess(); var webApiAdapter = new BlogPostWebApiAdapter(fakeConfig, mockWebApiDataAccess); var stub_entity = new BlogPostFactory().Create(); var stub_list = new List <BlogPost> { stub_entity }; var stub_response = MakeHttpResponseMessage(HttpStatusCode.OK); stub_response.Content = new StringContent(JsonConvert.SerializeObject(stub_list)); mockWebApiDataAccess.StubSendRequest(stub_response); webApiAdapter.ListByAuthorId(stub_entity.AuthorId); mockWebApiDataAccess.VerifySendRequestCalled(1); }