예제 #1
0
        public void ToString_MultipleVariablesInTruthTableRow_NumberOfPiecesShouldBeEquivalentToNumberOfVariablesPlusOneForResultColumn()
        {
            // Arrange
            Random        rng = new Random();
            int           numberOfVariables = rng.Next(1, 5);
            TruthTableRow ttr = GenerateTruthTableRowWithXPropositionVariables(numberOfVariables);

            // Act
            String result = ttr.ToString();

            String[] parts = result.Split(TruthTableRow.GetPadding());

            int numberOfExpectedParts = numberOfVariables + 1;

            // Assert
            parts.Length.Should().Be(numberOfExpectedParts, "Because the string should display a value for each variable and a result");
        }
예제 #2
0
        public void ToString_MultipleVariablesInTruthTable_NumberOfPiecesShouldBeEquivalentToNumberOfVariablesPlusOneForResultColumn(string toParseExpression)
        {
            // Arrange
            parser = new Parser(toParseExpression);
            Proposition root = parser.Parse();
            TruthTable  tt   = new TruthTable(root);

            int numberOfVariables     = root.GetVariables().Count;
            int numberOfExpectedParts = numberOfVariables + 1;

            // Act
            String result = tt.TableHeader();

            String[] parts = result.Split(TruthTableRow.GetPadding());

            // Assert
            parts.Length.Should().Be(numberOfExpectedParts, "Because the string should display a value for each variable and a result");
        }