Esempio n. 1
0
        public void WhenThereisNoPersonInfoInStoredTable_thenShouldCallTheAPIForGettingTheUserInfo()
        {
            PersonLocalStorageMock.Setup(x => x.FindPersonAsync(It.IsAny <ExternalId>()))
            .Returns(Task.FromResult <Person>(null));
            ContextMappingLocalStorage.Setup(x => x.Resolve(It.IsAny <string>())).Returns(
                "http://we-d-app-youforce-ext-resolver.azurewebsites.net/api/persons/{id}/personaldetails");
            RestSharpHelper.Setup(e => e.Get <Person>(It.IsAny <RestSharpParams>())).Returns(GetRandomPersonData());
            var userInfo = new UserInformation(PersonLocalStorageMock.Object, ContextMappingLocalStorage.Object,
                                               RestSharpHelper.Object);
            var result = userInfo.GetUsers(new List <ExternalId>
            {
                ExternalIdMockInfoUser1,
                ExternalIdMockInfoUser2
            });

            Assert.True(result.ToList().Count == 2);
        }