Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

CustomerActivityServiceTests.cs

using FluentAssertions;
using Nop.Services.Customers;
using Nop.Services.Logging;
using NUnit.Framework;

namespace Nop.Tests.Nop.Services.Tests.Logging;

[TestFixture]
public class CustomerActivityServiceTests : ServiceTest
{
    private ICustomerActivityService _customerActivityService;
    private ICustomerService _customerService;

    [OneTimeSetUp]
    public void SetUp()
    {
        _customerActivityService = GetService();
        _customerService = GetService();
    }

    [Test]
    public async Task CanFindActivities()
    {
        var customer = await _customerService.GetCustomerByEmailAsync(NopTestsDefaults.AdminEmail);

        var activities = await _customerActivityService.GetAllActivitiesAsync(customerId: customer.Id, pageSize: 10);
        activities.Any().Should().BeTrue();

        customer = await _customerService.GetCustomerByEmailAsync("builtin@search_engine_record.com");

        activities = await _customerActivityService.GetAllActivitiesAsync(customerId: customer.Id, pageSize: 10);
        activities.Any().Should().BeFalse();
    }
}