public CustomerProfileController(CustomerProfileService customerProfileService, CustomerProfileViewService customerProfileViewService, ICustomerService customerService, IMobSocialService mobSocialService, ICustomerFavoriteSongService customerFavoriteSongService, IMusicService musicService, IWorkContext workContext) { _customerProfileService = customerProfileService; _customerProfileViewService = customerProfileViewService; _customerService = customerService; _customerFavoriteSongService = customerFavoriteSongService; _mobSocialService = mobSocialService; _musicService = musicService; _workContext = workContext; }
public async Task ProcessParticipatedInCampaignEvent_WhenCustomerProfileExists_UpdateTotalCampaignsContributedCount() { //Arrange var service = new CustomerProfileService(_customerProfileRepositoryMock.Object, EmptyLogFactory.Instance, _convertCurrencyServiceMock.Object); var customerId = Guid.Parse(CustomerProfileTestData.CustomerId); _customerProfileRepositoryMock.Setup(c => c.GetCustomerProfileAsync(It.IsAny <Guid>())) .ReturnsAsync(CustomerProfileTestData.CustomerProfileModels.FirstOrDefault(c => c.CustomerId == customerId)); _customerProfileRepositoryMock.Setup(x => x.CreateOrUpdateAsync(It.IsAny <CustomerProfileModel>())) .Returns(Task.CompletedTask); //Act await service.ProcessParticipatedInCampaignEvent(customerId); //Assert _customerProfileRepositoryMock.Verify(c => c.CreateOrUpdateAsync(It.IsAny <CustomerProfileModel>())); }
public async Task InsertCustomerPurchaseAmount_WhenSuchProfileDoesNotExist() { //Arrange _customerProfileRepositoryMock.Setup(x => x.GetCustomerProfileAsync(It.IsAny <Guid>())) .ReturnsAsync(default(CustomerProfileModel)); _customerProfileRepositoryMock.Setup(x => x.CreateOrUpdateAsync(It.IsAny <CustomerProfileModel>())) .Returns(Task.CompletedTask); var service = new CustomerProfileService(_customerProfileRepositoryMock.Object, EmptyLogFactory.Instance, _convertCurrencyServiceMock.Object); //Act await service.InsertOrUpdateCustomerPurchaseAmount(Guid.NewGuid(), 50); //Assert _customerProfileRepositoryMock.Verify(x => x.GetCustomerProfileAsync(It.IsAny <Guid>()), Times.Once); _customerProfileRepositoryMock.Verify(x => x.CreateOrUpdateAsync(It.Is <CustomerProfileModel>(c => c.TotalPurchasedAmount == 50)), Times.Once); _customerProfileRepositoryMock.Verify(x => x.UpdateAsync(It.IsAny <CustomerProfileModel>()), Times.Never); }
public async Task ProcessFriendReferralEvent_WhenSuchProfileDoesNotExist() { //Arrange _customerProfileRepositoryMock.Setup(x => x.GetCustomerProfileAsync(It.IsAny <Guid>())) .ReturnsAsync(default(CustomerProfileModel)); _customerProfileRepositoryMock.Setup(x => x.CreateOrUpdateAsync(It.IsAny <CustomerProfileModel>())) .Returns(Task.CompletedTask); var service = new CustomerProfileService(_customerProfileRepositoryMock.Object, EmptyLogFactory.Instance, _convertCurrencyServiceMock.Object); var rightGuid = Guid.NewGuid(); //Act await service.ProcessFriendReferralEvent(rightGuid); //Assert _customerProfileRepositoryMock.Verify(x => x.GetCustomerProfileAsync(It.IsAny <Guid>()), Times.Once); _customerProfileRepositoryMock.Verify(x => x.CreateOrUpdateAsync(It.Is <CustomerProfileModel>(c => c.TotalReferredFriendCount == 1)), Times.Once); _customerProfileRepositoryMock.Verify(x => x.UpdateAsync(It.IsAny <CustomerProfileModel>()), Times.Never); }
public CustomerProfileApiController(CustomerProfileService customerProfileService, CustomerProfileViewService customerProfileViewService, ICustomerService customerService, IMobSocialService mobSocialService, ICustomerFavoriteSongService customerFavoriteSongService, IMusicService musicService, IWorkContext workContext, IFriendService friendService, IPictureService pictureService, mobSocialSettings mobSocialSettings, MediaSettings mediaSettings, IGenericAttributeService genericAttributeService, ICustomerFollowService customerFollowService) { _customerProfileService = customerProfileService; _customerProfileViewService = customerProfileViewService; _customerService = customerService; _customerFavoriteSongService = customerFavoriteSongService; _mobSocialService = mobSocialService; _musicService = musicService; _workContext = workContext; _friendService = friendService; _pictureService = pictureService; _mobSocialSettings = mobSocialSettings; _mediaSettings = mediaSettings; _genericAttributeService = genericAttributeService; _customerFollowService = customerFollowService; }
public CustomerProfileApiController(CustomerProfileService customerProfileService, CustomerProfileViewService customerProfileViewService, ICustomerService customerService, IMobSocialService mobSocialService, ICustomerFavoriteSongService customerFavoriteSongService, IMusicService musicService, IWorkContext workContext, IFriendService friendService, IPictureService pictureService, mobSocialSettings mobSocialSettings, MediaSettings mediaSettings, IGenericAttributeService genericAttributeService, ICustomerFollowService customerFollowService) { _customerProfileService = customerProfileService; _customerProfileViewService = customerProfileViewService; _customerService = customerService; _customerFavoriteSongService = customerFavoriteSongService; _mobSocialService = mobSocialService; _musicService = musicService; _workContext = workContext; _friendService = friendService; _pictureService = pictureService; _mobSocialSettings = mobSocialSettings; _mediaSettings = mediaSettings; _genericAttributeService = genericAttributeService; _customerFollowService = customerFollowService; }