コード例 #1
0
        public void HandlesExceptionForDefaultCase()
        {
            // Arrange
            var patternMatching = new PatternMatching();

            // Act | Assert
            Assert.Throws <ArgumentNullException>("machine", () => patternMatching.MatchingMachineProduct(null));
        }
コード例 #2
0
        public void MatchesPizzaPatternInSwitch()
        {
            // Arrange
            var      patternMatching = new PatternMatching();
            IMachine pizza           = new PizzaMachine();

            // Act
            var result = patternMatching.MatchingMachineProduct(pizza);

            // Assert
            Assert.Equal("Pizza", result);
        }
コード例 #3
0
        public void MatchesNotInCasePatternInSwitch()
        {
            // Arrange
            var      patternMatching = new PatternMatching();
            IMachine notInCase       = new NotInCaseMachine();

            // Act
            var result = patternMatching.MatchingMachineProduct(notInCase);

            // Assert
            Assert.Equal(null, result);
        }
コード例 #4
0
        public void MatchesFishAndChipsPatternInSwitch()
        {
            // Arrange
            var      patternMatching = new PatternMatching();
            IMachine fishAndChips    = new FishAndChipsMachine();

            // Act
            var result = patternMatching.MatchingMachineProduct(fishAndChips);

            // Assert
            Assert.Equal("Fish and chips", result);
        }