public void InitConsole_JobIdIsAddedToHash() { var storage = new ConsoleStorage(_connection.Object); storage.InitConsole(_consoleId); _connection.Verify(x => x.CreateWriteTransaction(), Times.Once); _transaction.Verify(x => x.SetRangeInHash(_consoleId.GetHashKey(), It2.AnyIs <KVP>(p => p.Key == "jobId"))); _transaction.Verify(x => x.Commit(), Times.Once); }
public void AddLine_ProgressBarIsAddedToSet_AndProgressIsUpdated() { var storage = new ConsoleStorage(_connection.Object); var line = new ConsoleLine() { Message = "1", ProgressValue = 10 }; storage.AddLine(_consoleId, line); Assert.False(line.IsReference); _connection.Verify(x => x.CreateWriteTransaction(), Times.Once); _transaction.Verify(x => x.AddToSet(_consoleId.GetSetKey(), It.IsAny <string>(), It.IsAny <double>())); _transaction.Verify(x => x.SetRangeInHash(_consoleId.GetHashKey(), It2.AnyIs <KVP>(p => p.Key == "progress"))); _transaction.Verify(x => x.Commit(), Times.Once); }
public void AddLine_LongLineIsAddedToHash_AndReferenceIsAddedToSet() { var storage = new ConsoleStorage(_connection.Object); var line = new ConsoleLine() { Message = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor " + "incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud " + "exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure " + "dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. " + "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." }; storage.AddLine(_consoleId, line); Assert.True(line.IsReference); _connection.Verify(x => x.CreateWriteTransaction(), Times.Once); _transaction.Verify(x => x.AddToSet(_consoleId.GetSetKey(), It.IsAny <string>(), It.IsAny <double>())); _transaction.Verify(x => x.SetRangeInHash(_consoleId.GetHashKey(), It2.AnyIs <KVP>(p => p.Key == line.Message))); _transaction.Verify(x => x.Commit(), Times.Once); }