private Person GetUserByContext(ref Dictionary <string, string> contextMapping, ExternalId user) { var urlEndPoint = contextMapping.ContainsKey(user.Context) ? contextMapping[user.Context] : ContextMappingLocalStorage.Resolve(user.Context); if (urlEndPoint == null) { return(GetPersonWithNoPersonInfo(user)); } if (!contextMapping.ContainsKey(user.Context)) { contextMapping.Add(user.Context, urlEndPoint); } var personInfo = RestSharpHelper.Get <PersonalInfo>(new RestSharpParams() { ApiEndPoint = urlEndPoint.Replace("{id}", user.Id), BaseUrl = GetBaseUri(urlEndPoint), MethodType = Method.GET }); var person = PersonLocalStorage.CreatePersonAsync(new Person(user, personInfo)).Result; return(person); }
public void CreatePersonAsync_Test() { //Arrange _personLocalStorage = new PersonLocalStorage(_azureTableStorageRepoMock.Object); Person person = new Person(new ExternalId(), new PersonalInfo()); _azureTableStorageRepoMock.Setup(e => e.InsertRecordToTable(It.IsAny <StoredPersonalInfo>())) .Returns(Task.FromResult(new TableResult())); //Act var result = _personLocalStorage.CreatePersonAsync(person); //Assert Assert.AreEqual("RanToCompletion", result.Status.ToString()); }