public void ExpandLowerTaxaCommand_RunWithNullDocumentAndNullProgramSettings_ShouldThrowArgumentNullException()
        {
            // Arrange
            var parserMock = new Mock <IExpander>();
            var command    = new ExpandLowerTaxaCommand(parserMock.Object);

            // Act + Assert
            var exception = Assert.ThrowsAsync <ArgumentNullException>(() =>
            {
                return(command.Run(null, null));
            });

            parserMock.Verify(p => p.Parse(It.IsAny <XmlNode>()), Times.Never);
        }
        public void ExpandLowerTaxaCommand_RunWithValidDocumentAndNullProgramSettings_ShouldThrowArgumentNullExceptionWithCorrectParamName()
        {
            // Arrange
            var parserMock   = new Mock <IExpander>();
            var command      = new ExpandLowerTaxaCommand(parserMock.Object);
            var documentMock = new Mock <IDocument>();

            // Act + Assert
            var exception = Assert.ThrowsAsync <ArgumentNullException>(() =>
            {
                return(command.Run(documentMock.Object, null));
            });

            Assert.AreEqual(ParameterNames.Settings, exception.ParamName, "ParamName is not correct.");

            parserMock.Verify(p => p.Parse(It.IsAny <XmlNode>()), Times.Never);
        }
        public async Task ExpandLowerTaxaCommand_RunWithValidDocumentAndValidProgramSettings_ShouldCallParserWithCorrectParameter()
        {
            // Arrange
            var parserMock   = new Mock <IExpander>();
            var command      = new ExpandLowerTaxaCommand(parserMock.Object);
            var settingsMock = new Mock <ICommandSettings>();
            var documentMock = new Mock <IDocument>();

            var xmldocumentStub = new XmlDocument();

            xmldocumentStub.LoadXml("<a />");

            documentMock
            .SetupGet(d => d.XmlDocument)
            .Returns(xmldocumentStub);

            // Act
            var result = await command.Run(documentMock.Object, settingsMock.Object);

            // Assert
            parserMock.Verify(p => p.Parse(It.IsAny <XmlNode>()), Times.Once);
            parserMock.Verify(p => p.Parse(xmldocumentStub.DocumentElement), Times.Once);
        }