Example #1
0
 public void Duplicate(string sessionId)
 {
     actionQueue.QueueCommand(sessionId, () =>
     {
         logging.Log($"Starting Duplicate on {sessionId}");
         service.Duplicate(sessionId);
         logging.Log($"Duplicate on {sessionId} done");
     });
 }
Example #2
0
        public void CanDuplicate()
        {
            // Arrange
            var mocks     = new MockRepository(MockBehavior.Strict);
            var mapper    = mocks.Create <ISessionMapper>();
            var persistor = mocks.Create <IPersister>();
            var accessor  = mocks.Create <IAccessor>();

            mapper.Setup(s => s.StartOrGetSession(It.IsAny <string>())).Returns <string>(s => $"{s}_dalSession");
            persistor.Setup(s => s.SetData(It.IsAny <string>(), It.IsAny <string>()));
            accessor.Setup(s => s.GetData(It.IsAny <string>())).Returns("aaaaaaaa").Verifiable();

            var service = new ImportantService(
                mapper.Object,
                accessor.Object,
                persistor.Object,
                Mock.Of <ILogging>());

            // Act
            service.Duplicate("SessionId");

            // Assert
            mocks.Verify();
        }