public void TestFailInsert() { var mockClient = new Mock<IHttpClient>(); mockClient.Setup(m => m.Post(It.IsAny<HttpRequestData>())).Returns<HttpRequestData>((i) => CheckRequestFailInsert(i) ); CarreAuthProvider pr = new CarreAuthProvider(); pr.ConfigurationLocation = "../../Fixtures/authTokens.xml"; CarreOutput co = new CarreOutput(); co.AuthProvider = pr; co.Client = mockClient.Object; List<OutputResult> results = co.Output(this.GetMockData()); Assert.IsTrue(results.Where(o => o.Success == false).Count() == 2); Assert.IsTrue(results.Count == this.GetMockData().Select(p => p.Data).First().Count); }
public void TestSuccessInsert() { var mockClient = new Mock <IHttpClient>(); mockClient.Setup(m => m.Post(It.IsAny <HttpRequestData>())).Returns <HttpRequestData>((i) => CheckRequestSuccessInsert(i)); CarreAuthProvider pr = new CarreAuthProvider(); pr.ConfigurationLocation = "../../Fixtures/authTokens.xml"; CarreOutput co = new CarreOutput(); co.AuthProvider = pr; co.Client = mockClient.Object; List <OutputResult> results = co.Output(this.GetMockData()); Assert.IsTrue(results.Where(o => o.Success == false).Count() == 1); Assert.IsTrue(results.Count == this.GetMockData().Select(p => p.Data).First().Count); }