public void ParametersTest() { Mock <IRestClient> client = new Mock <IRestClient>(); Mock <IRestParameters> restParameters = new Mock <IRestParameters>(); IMeasuresComponentTreeService service = new MeasuresComponentTreeService(client.Object, restParameters.Object); service.SetBaseComponentKey("key"); restParameters.Verify(p => p.SetParameter(@"baseComponentKey", @"key")); }
public void PageTest() { // given we have a response with two pages, that has 2 components each var client = new Mock <IRestClient>(); var restParameters = new Mock <IRestParameters>(); client.Setup(p => p.SetPath(It.IsAny <string>())).Returns(client.Object); IMeasuresComponentTreeService service = new MeasuresComponentTreeService(client.Object, restParameters.Object); string response = pageResponse; client.SetupSequence(p => p.Get(It.IsAny <IRestParameters>())).Returns(response).Returns(response).Returns(endPage); //when we execute the service var components = service.Execute(); //then we expect four components in the result Assert.AreEqual(4, components.Count); }