public void ParseTreatmentMetaWithInternalInformationCommand_WithNullParser_ShouldThrowArgumentNullExceptionWithCorrectParamName()
        {
            // Arrange + Act + Assert
            var exception = Assert.Throws <ArgumentNullException>(() =>
            {
                var command = new ParseTreatmentMetaWithInternalInformationCommand(null);
            });

            Assert.AreEqual(ParameterNames.Parser, exception.ParamName, "ParamName is not correct.");
        }
        public void ParseTreatmentMetaWithInternalInformationCommand_RunWithNullDocumentAndNullProgramSettings_ShouldThrowArgumentNullException()
        {
            // Arrange
            var parserMock = new Mock <ITreatmentMetaParserWithInternalInformation>();
            var command    = new ParseTreatmentMetaWithInternalInformationCommand(parserMock.Object);

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

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

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

            // Assert
            parserMock.Verify(p => p.Parse(It.IsAny <IDocument>()), Times.Once);
            parserMock.Verify(p => p.Parse(documentMock.Object), Times.Once);
        }
        public void ParseTreatmentMetaWithInternalInformationCommand_RunWithValidDocumentAndNullProgramSettings_ShouldThrowArgumentNullExceptionWithCorrectParamName()
        {
            // Arrange
            var parserMock   = new Mock <ITreatmentMetaParserWithInternalInformation>();
            var command      = new ParseTreatmentMetaWithInternalInformationCommand(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 <IDocument>()), Times.Never);
        }
        public void ParseTreatmentMetaWithInternalInformationCommand_WithValidParser_ShouldCorrectlyInitializeObject()
        {
            // Arrange + Act
            var parserMock = new Mock <ITreatmentMetaParserWithInternalInformation>();
            var command    = new ParseTreatmentMetaWithInternalInformationCommand(parserMock.Object);

            // Assert
            Assert.IsNotNull(command, "Initialized Command object should not be null.");

            var parser = PrivateField.GetInstanceField(
                typeof(ParseTreatmentMetaWithInternalInformationCommand).BaseType,
                command,
                ParameterNames.Parser);

            Assert.IsNotNull(parser, "Private parser field should not be null.");
            Assert.AreSame(parserMock.Object, parser, "Private parser field should not be set correctly.");
        }