public async Task GetFileDataAsyncReturnsCorrectObjectTest() { var responseClass = new TestResponseClass(); var mockHttpClient = new Mock <IRestClient>(); mockHttpClient.Setup(x => x.GetItemAsync <TestResponseClass>(It.IsAny <string>())).Returns(Task.FromResult(responseClass)); var filesPersistenceClient = new FilesPersistenceClient(mockHttpClient.Object); var result = await filesPersistenceClient.GetFileDataAsync <TestResponseClass>(Guid.NewGuid()); Assert.AreEqual(responseClass, result); }
public async Task GetFormDataAsyncReturnsCorrectObjectTest() { var responseClass = new TestResponseClass(); var mockHttpClient = new Mock <IRestClient>(); var mockSerializationService = new Mock <ISerializationService>(); mockSerializationService.Setup(x => x.DeSerializeFormData <TestResponseClass>(It.IsAny <string>())).Returns(responseClass); var formsPersistenceClient = new FormsPersistenceClient(mockHttpClient.Object, mockSerializationService.Object); var result = await formsPersistenceClient.GetFormDataAsync <TestResponseClass>(Guid.NewGuid()); Assert.AreEqual(result, responseClass); }