示例#1
0
        public void Factory_EngineType_Success(FuzzyEngineType engineType, Type defuzzType)
        {
            //Arrange
            var factory = new FuzzyEngineFactory();

            //Act
            var engine = factory.Create(engineType);

            //Assert
            Assert.That(engine, Is.InstanceOf <FuzzyEngine>());
            Assert.That(engine.Defuzzification, Is.InstanceOf(defuzzType));
        }
        public IFuzzyEngine Create(FuzzyEngineType type)
        {
            switch (type)
            {
            case FuzzyEngineType.CoG:
                return(Create(new CoGDefuzzification()));

            case FuzzyEngineType.MoM:
                return(Create(new MoMDefuzzification()));

            default:
                throw new ArgumentException("Cannot create engine with type.");
            }
        }