Ejemplo n.º 1
0
        public void GetUserMap_Should_Return_Null_When_Get_Returns_InValid_Map()
        {
            var mockUserStorageService = Mock.GetUserStorageService();

            Mock.SetupGet(mockUserStorageService, returnValue: null);
            UserStorageAdapter userStorageServiceAdapter = new UserStorageAdapter(mockUserStorageService.Object);
            var result = userStorageServiceAdapter.GetUserMap(MockCampaignKey, MockUserId);

            Assert.Null(result);
        }
Ejemplo n.º 2
0
        public void GetUserMap_Should_Return_Null_When_Get_Throws_Execption()
        {
            var mockUserStorageService = Mock.GetUserStorageService();

            Mock.SetupGet(mockUserStorageService, new Exception("Test Method Exception"));
            UserStorageAdapter userStorageServiceAdapter = new UserStorageAdapter(mockUserStorageService.Object);
            var result = userStorageServiceAdapter.GetUserMap(MockCampaignKey, MockUserId);

            Assert.Null(result);

            mockUserStorageService.Verify(mock => mock.Get(It.IsAny <string>(), It.IsAny <string>()), Times.Once);
            mockUserStorageService.Verify(mock => mock.Get(It.Is <string>(val => MockUserId.Equals(val)), It.Is <string>(val => MockCampaignKey.Equals(val))), Times.Once);
        }
Ejemplo n.º 3
0
        public void GetUserMap_Should_Match_And_Return_Profile_Data_When_Get_Returns_Valid_Map()
        {
            var mockUserStorageService = Mock.GetUserStorageService();

            Mock.SetupGet(mockUserStorageService, GetUserStorageMap());
            UserStorageAdapter userStorageServiceAdapter = new UserStorageAdapter(mockUserStorageService.Object);
            var result = userStorageServiceAdapter.GetUserMap(MockCampaignKey, MockUserId);

            Assert.NotNull(result);
            Assert.Equal(MockUserId, result.UserId);
            Assert.Equal(MockCampaignKey, result.CampaignKey);
            Assert.Equal(MockVariationName, result.VariationName);
        }