mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
removed an unused class
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
using System.Security;
|
||||
using mRemoteNG.Config.Serializers;
|
||||
using mRemoteNG.Credential;
|
||||
using mRemoteNG.Security;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace mRemoteNGTests.Credential
|
||||
{
|
||||
public class StaticSerializerKeyProviderDecoratorTests
|
||||
{
|
||||
private StaticSerializerKeyProviderDecorator<object, string> _serializerKeyProvider;
|
||||
private ISerializer<object, string> _baseSerializer;
|
||||
private IHasKey _objThatNeedsKey;
|
||||
private readonly SecureString _key = "someKey1".ConvertToSecureString();
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_objThatNeedsKey = Substitute.For<IHasKey>();
|
||||
_baseSerializer = Substitute.For<ISerializer<object, string>>();
|
||||
_serializerKeyProvider = new StaticSerializerKeyProviderDecorator<object, string>(_objThatNeedsKey, _baseSerializer) { Key = _key };
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CallsBaseSerializer()
|
||||
{
|
||||
var creds = new[] { Substitute.For<ICredentialRecord>() };
|
||||
_serializerKeyProvider.Serialize(creds);
|
||||
_baseSerializer.Received().Serialize(creds);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PassesOnItsKey()
|
||||
{
|
||||
var creds = new[] { Substitute.For<ICredentialRecord>() };
|
||||
_serializerKeyProvider.Serialize(creds);
|
||||
Assert.That(_objThatNeedsKey.Key, Is.EqualTo(_serializerKeyProvider.Key));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -139,7 +139,6 @@
|
||||
<Compile Include="Credential\CredentialDomainUserComparerTests.cs" />
|
||||
<Compile Include="Credential\CredentialRepositoryListTests.cs" />
|
||||
<Compile Include="Credential\CredentialRecordTests.cs" />
|
||||
<Compile Include="Credential\StaticSerializerKeyProviderDecoratorTests.cs" />
|
||||
<Compile Include="IntegrationTests\XmlCredentialSerializerLifeCycleTests.cs" />
|
||||
<Compile Include="IntegrationTests\XmlSerializationLifeCycleTests.cs" />
|
||||
<Compile Include="Messages\MessageCollectorTests.cs" />
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
using System;
|
||||
using System.Security;
|
||||
using mRemoteNG.Config.Serializers;
|
||||
using mRemoteNG.Security;
|
||||
|
||||
namespace mRemoteNG.Credential
|
||||
{
|
||||
public class StaticSerializerKeyProviderDecorator<TIn, TOut> : ISerializer<TIn, TOut>, IHasKey
|
||||
{
|
||||
private readonly ISerializer<TIn, TOut> _baseSerializer;
|
||||
private readonly IHasKey _objThatNeedsKey;
|
||||
private SecureString _key = new SecureString();
|
||||
|
||||
public SecureString Key
|
||||
{
|
||||
get { return _key; }
|
||||
set
|
||||
{
|
||||
if (value == null) return;
|
||||
_key = value;
|
||||
}
|
||||
}
|
||||
|
||||
public StaticSerializerKeyProviderDecorator(IHasKey objThatNeedsKey, ISerializer<TIn, TOut> baseSerializer)
|
||||
{
|
||||
if (objThatNeedsKey == null)
|
||||
throw new ArgumentNullException(nameof(objThatNeedsKey));
|
||||
if (baseSerializer == null)
|
||||
throw new ArgumentNullException(nameof(baseSerializer));
|
||||
|
||||
_objThatNeedsKey = objThatNeedsKey;
|
||||
_baseSerializer = baseSerializer;
|
||||
}
|
||||
|
||||
public TOut Serialize(TIn model)
|
||||
{
|
||||
_objThatNeedsKey.Key = Key;
|
||||
return _baseSerializer.Serialize(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -222,7 +222,6 @@
|
||||
<Compile Include="Credential\CredentialRepoUnlockerBuilder.cs" />
|
||||
<Compile Include="Credential\CredentialServiceFactory.cs" />
|
||||
<Compile Include="Credential\CredentialsService.cs" />
|
||||
<Compile Include="Credential\StaticSerializerKeyProviderDecorator.cs" />
|
||||
<Compile Include="Security\Factories\CryptoProviderFactoryFromSettings.cs" />
|
||||
<Compile Include="Security\Factories\LegacyInsecureCryptoProviderFactory.cs" />
|
||||
<Compile Include="Security\ICryptoProviderFactory.cs" />
|
||||
|
||||
Reference in New Issue
Block a user