Ejemplo n.º 1
0
        public void CanTruncate()
        {
            // Arrange
            var mocks     = new MockRepository(MockBehavior.Strict);
            var mapper    = mocks.Create <ISessionMapper>();
            var persistor = mocks.Create <IPersister>();
            var accessor  = mocks.Create <IAccessor>();

            string dalSessionId = "aa";

            mapper.Setup(s => s.TryGetExistingSession(It.IsAny <string>(), out dalSessionId)).Returns(true).Callback(new TryGetExistingSessionCallback((string s, out string v) => v = $"{s}_storageSession"));
            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.Truncate("SessionId", 2);

            // Assert
            mocks.Verify();
        }
Ejemplo n.º 2
0
 public void Truncate(string sessionId, int number)
 {
     logging.Log($"Starting Duplicate on {sessionId}");
     service.Truncate(sessionId, number);
     logging.Log($"Duplicate on {sessionId} done");
 }