private BackendlessResponse <TestModel> SetupSuccessfulPull(params TestModel[] contents) { var response = BackendlessResponse <TestModel> .Success(contents); _responseParser.ParseArray <TestModel>(Json).Returns(response); return(response); }
private Assessment SetupSuccessfulPost(Assessment localAssessment) { var clonedLocalAssessment = new Assessment { ObjectId = localAssessment.ObjectId }; var savedAssessment = CreateSavedAssessment(); var url = Connection.GenerateTableUrl <Assessment>(); _jsonSerializer.Clone(localAssessment).Returns(clonedLocalAssessment); var serializedObject = $"{savedAssessment.ObjectId}-serialized"; _jsonSerializer.Serialize(clonedLocalAssessment).Returns(serializedObject); var jsonResponse = $"{savedAssessment.ObjectId}-response"; _restServiceCaller.Post(url, Arg.Any <Dictionary <string, string> >(), serializedObject) .Returns(Task.FromResult(jsonResponse)); _responseParser.Parse <Assessment>(jsonResponse).Returns(BackendlessResponse <Assessment> .Success(savedAssessment)); return(savedAssessment); }