public void DelegatesControlToStringEncryptor()
        {
            var request = new EncryptForLocalMachineScopeRequest {
                StringToEncrypt = "The user data",
                Purposes        = new[] { "My", "Purposes" }
            };
            const string expectedResult = "{Cypher}";

            ConfigureStringEncryptor_ToReturn(expectedResult);

            var actual = _sut.Handle(request).Result;

            Assert.That(actual, Is.Not.Null);
            Assert.That(actual, Is.EqualTo(expectedResult));
            A.CallTo(() => _localMachineScopeStringEncryptor.Encrypt(request.StringToEncrypt, request.Purposes))
            .MustHaveHappened();
        }
예제 #2
0
 public Task <string> Handle(EncryptForLocalMachineScopeRequest request)
 {
     return(Task.FromResult(_localMachineScopeStringEncryptor.Encrypt(request.StringToEncrypt, request.Purposes)));
 }