mirror of
https://github.com/bitwarden/server.git
synced 2024-11-24 12:35:25 +01:00
edd4bc2623
* Add Disable Send policy * Test DisableSend policy * PR Review * Update tests for using CurrentContext This required making an interface for CurrentContext and mocking out the members used. The interface can be expanded as needed for tests. I moved CurrentContext to a folder, which changes the namespace and causes a lot of file touches, but most are just adding a reference * Fix failing test * Update exemption to include all exempt users * Move all CurrentContext usages to ICurrentContext * PR review. Match messaging with Web
46 lines
1.4 KiB
C#
46 lines
1.4 KiB
C#
using System;
|
|
using Bit.Core.Context;
|
|
using Bit.Core.Repositories;
|
|
using Bit.Core.Services;
|
|
using NSubstitute;
|
|
using Xunit;
|
|
|
|
namespace Bit.Core.Test.Services
|
|
{
|
|
public class EventServiceTests
|
|
{
|
|
private readonly EventService _sut;
|
|
|
|
private readonly IEventWriteService _eventWriteService;
|
|
private readonly IOrganizationUserRepository _organizationUserRepository;
|
|
private readonly IApplicationCacheService _applicationCacheService;
|
|
private readonly CurrentContext _currentContext;
|
|
private readonly GlobalSettings _globalSettings;
|
|
|
|
public EventServiceTests()
|
|
{
|
|
_eventWriteService = Substitute.For<IEventWriteService>();
|
|
_organizationUserRepository = Substitute.For<IOrganizationUserRepository>();
|
|
_applicationCacheService = Substitute.For<IApplicationCacheService>();
|
|
_currentContext = new CurrentContext();
|
|
_globalSettings = new GlobalSettings();
|
|
|
|
_sut = new EventService(
|
|
_eventWriteService,
|
|
_organizationUserRepository,
|
|
_applicationCacheService,
|
|
_currentContext,
|
|
_globalSettings
|
|
);
|
|
}
|
|
|
|
// Remove this test when we add actual tests. It only proves that
|
|
// we've properly constructed the system under test.
|
|
[Fact]
|
|
public void ServiceExists()
|
|
{
|
|
Assert.NotNull(_sut);
|
|
}
|
|
}
|
|
}
|