public void GetPersonalizedPlanAsyncValidate(PersonalizedPlanViewModel personalizedPlan, dynamic expectedData) { //arrange var dbResponse = dbService.GetItemAsync <PersonalizedPlanViewModel>(personalizedPlan.PersonalizedPlanId.ToString(), dbSettings.ActionPlansCollectionId); dbResponse.ReturnsForAnyArgs <PersonalizedPlanViewModel>(personalizedPlan); var response = personalizedPlanBusinessLogic.GetPersonalizedPlanAsync(personalizedPlan.PersonalizedPlanId); //act var actualResult = JsonConvert.SerializeObject(response.Result); var expectedResult = JsonConvert.SerializeObject(expectedData); //assert Assert.Equal(expectedResult, actualResult); }
public void GetCuratedExperienceAsyncValidate(CuratedExperience curatedExperiencedata, dynamic expectedData, Guid id) { //arrange var dbResponse = dbService.GetItemAsync <CuratedExperience>(id.ToString(), dbSettings.CuratedExperiencesCollectionId); dbResponse.ReturnsForAnyArgs <CuratedExperience>(curatedExperiencedata); var response = curatedExperience.GetCuratedExperienceAsync(id); //act var actualResult = JsonConvert.SerializeObject(response.Result); var expectedResult = JsonConvert.SerializeObject(expectedData); //assert Assert.Equal(expectedResult, actualResult); }
public async Task <PersonalizedPlanViewModel> GeneratePersonalizedPlanAsync(CuratedExperience curatedExperience, Guid answersDocId) { var a2jPersonalizedPlan = await dynamicQueries.FindItemWhereAsync <JObject>(cosmosDbSettings.A2JAuthorDocsCollectionId, Constants.Id, curatedExperience.A2jPersonalizedPlanId.ToString()); var userAnswers = await backendDatabaseService.GetItemAsync <CuratedExperienceAnswers>(answersDocId.ToString(), cosmosDbSettings.GuidedAssistantAnswersCollectionId); if (a2jPersonalizedPlan == null || userAnswers == null || userAnswers.AnswersDocId == default(Guid)) { return(null); } return(await personalizedPlanViewModelMapper.MapViewModel(personalizedPlanEngine.Build(a2jPersonalizedPlan, userAnswers))); }
public async Task <CuratedExperience> GetCuratedExperienceAsync(Guid id) { return(await dbService.GetItemAsync <CuratedExperience>(id.ToString(), dbSettings.CuratedExperiencesCollectionId)); }