public void CreateSessionReturnsASessionResult() { // Act var creationResult = sessionGenerator.CreateSession(DummySalt, currentDate); //Assert Assert.True(!string.IsNullOrWhiteSpace(creationResult.EncodedSessionId) && creationResult.Counter > 0); }
public DfcUserSession NewSession() { var currentDate = DateTime.UtcNow; var sessionResult = sessionIdGenerator.CreateSession(sessionConfig.Salt, currentDate); var partitionKey = partitionKeyGenerator.GeneratePartitionKey(sessionConfig.ApplicationName, sessionResult.EncodedSessionId); return(new DfcUserSession { Salt = $"{sessionConfig.Salt}|{sessionResult.Counter}", CreatedDate = currentDate, SessionId = sessionResult.EncodedSessionId, PartitionKey = partitionKey, }); }
public void NewSessionReturnsSessionObject() { // Arrange const string dummyPartitionKey = "dummyPartitionKey"; var dummySession = new SessionResult { Counter = 123, EncodedSessionId = "EncodedSessionId", }; A.CallTo(() => sessionIdGenerator.CreateSession(A <string> .Ignored, A <DateTime> .Ignored)).Returns(dummySession); A.CallTo(() => partitionKeyGenerator.GeneratePartitionKey(A <string> .Ignored, A <string> .Ignored)).Returns(dummyPartitionKey); // Act var session = sessionClient.NewSession(); // Assert Assert.NotNull(session); Assert.Equal($"{config.Salt}|{dummySession.Counter}", session.Salt); Assert.Equal(dummySession.EncodedSessionId, session.SessionId); Assert.Equal(dummyPartitionKey, session.PartitionKey); }