public void GetUserMap_Should_Return_Null_When_LookUp_Returns_InValid_Map() { var mockUserProfileService = Mock.GetUserProfileService(); Mock.SetupLookup(mockUserProfileService, returnValue: null); UserProfileAdapter userProfileServiceAdapter = new UserProfileAdapter(mockUserProfileService.Object); var result = userProfileServiceAdapter.GetUserMap(MockCampaignTestKey, MockUserId); Assert.Null(result); }
public void GetUserMap_Should_Return_Null_When_LookUp_Throws_Execption() { var mockUserProfileService = Mock.GetUserProfileService(); Mock.SetupLookup(mockUserProfileService, new Exception("Test Method Exception")); UserProfileAdapter userProfileServiceAdapter = new UserProfileAdapter(mockUserProfileService.Object); var result = userProfileServiceAdapter.GetUserMap(MockCampaignTestKey, MockUserId); Assert.Null(result); mockUserProfileService.Verify(mock => mock.Lookup(It.IsAny <string>(), It.IsAny <string>()), Times.Once); mockUserProfileService.Verify(mock => mock.Lookup(It.Is <string>(val => MockUserId.Equals(val)), It.Is <string>(val => MockCampaignTestKey.Equals(val))), Times.Once); }
public void GetUserMap_Should_Match_And_Return_Profile_Data_When_LookUp_Returns_Valid_Map() { var mockUserProfileService = Mock.GetUserProfileService(); Mock.SetupLookup(mockUserProfileService, GetUserProfileMap()); UserProfileAdapter userProfileServiceAdapter = new UserProfileAdapter(mockUserProfileService.Object); var result = userProfileServiceAdapter.GetUserMap(MockCampaignTestKey, MockUserId); Assert.NotNull(result); Assert.Equal(MockUserId, result.UserId); Assert.Equal(MockCampaignTestKey, result.CampaignTestKey); Assert.Equal(MockVariationName, result.VariationName); }