Esempio n. 1
0
        public void CountTest()
        {
            // Arrange
            var items        = new int[] { 3, 4, 2 };
            var countOptions = new CountOptions();

            // Act
            ConzoleUtils.Count(items);

            // Assert
            mockConsole.Verify(c => c.WriteLine(countOptions.ResultFormatter(items.Length)));
            mockConsole.Verify(c => c.WriteLine(), Times.Once);
        }
Esempio n. 2
0
        public void CountCustomFormatTest()
        {
            // Arrange
            var items        = new int[] { 3, 4, 2 };
            var countOptions = new CountOptions();

            countOptions.PostNewLine     = false;
            countOptions.ResultFormatter = count => $"aaa {count} bbb";

            // Act
            ConzoleUtils.Count(items, countOptions);

            // Assert
            mockConsole.Verify(c => c.WriteLine(countOptions.ResultFormatter(items.Length)));
            mockConsole.Verify(c => c.WriteLine(), Times.Never);
        }