Esempio n. 1
0
        public void ReturnCorrectResult()
        {
            // Arrange
            var guidStringProvider         = new Mock <IGuidStringProvider>();
            var logFileParserEngineFactory = new Mock <ILogFileParserEngineFactory>();

            var guidString = "any string";

            guidStringProvider.Setup(p => p.NewGuidString()).Returns(guidString);

            var logFileParserEngine = new Mock <ILogFileParserEngine>();

            logFileParserEngineFactory.Setup(f => f.CreateLogFileParserEngine()).Returns(logFileParserEngine.Object);

            var logFileParserEngineManager = new LogFileParserEngineManager(guidStringProvider.Object, logFileParserEngineFactory.Object);

            var username = "******";

            // Act
            var actualResult = logFileParserEngineManager.StartLogFileParserEngine(username);

            // Assert
            Assert.That(actualResult, Is.EqualTo(guidString));
        }
Esempio n. 2
0
        public void InvokeILogFileParserEngineFactory_CreateLogFileParserEngineMethodOnce()
        {
            // Arrange
            var guidStringProvider         = new Mock <IGuidStringProvider>();
            var logFileParserEngineFactory = new Mock <ILogFileParserEngineFactory>();

            var guidString = "any string";

            guidStringProvider.Setup(p => p.NewGuidString()).Returns(guidString);

            var logFileParserEngine = new Mock <ILogFileParserEngine>();

            logFileParserEngineFactory.Setup(f => f.CreateLogFileParserEngine()).Returns(logFileParserEngine.Object);

            var logFileParserEngineManager = new LogFileParserEngineManager(guidStringProvider.Object, logFileParserEngineFactory.Object);

            var username = "******";

            // Act
            logFileParserEngineManager.StartLogFileParserEngine(username);

            // Assert
            logFileParserEngineFactory.Verify(f => f.CreateLogFileParserEngine(), Times.Once);
        }