public void GetRandomConnectiveSymbol_GetRandomConnectiveSymbol_ExpectedRandomConnectiveSymbolReturned()
        {
            // Arrange // Act
            char randomConnectiveSymbol = PropositionGenerator.GetRandomConnectiveSymbol();
            int  indexOfConnective      = Parser.CONNECTIVES.IndexOf(randomConnectiveSymbol);

            // Assert
            indexOfConnective.Should().BeGreaterOrEqualTo(0, "Because a random connective symbol is generated");
        }
Example #2
0
        public void Parse_SameSymbolCharacterInExpression_ShouldBeSameObject()
        {
            // Arrange
            char randomSymbol     = PropositionGenerator.GetRandomVariableLetter();
            char randomConnective = PropositionGenerator.GetRandomConnectiveSymbol();

            string proposition = $"{randomConnective}({randomSymbol}, {randomSymbol})";
            int    expectedNumberOfVariables = 1;

            parser = new Parser(proposition);

            // Act
            Proposition        root = parser.Parse();
            List <Proposition> expressionVariables = root.GetVariables();

            // Assert
            expressionVariables.Count.Should().Be(expectedNumberOfVariables, "because there should be one proposition variable for each unique character");
            expressionVariables[0].Data.Should().Be(randomSymbol, "because that is the only given symbol");
        }