Exemple #1
0
        static void Main(string[] args)
        {
            // factory pattern using Interface
            var result = FeatFactory
                         .GetFeatureImplementation(Constants.FeatFlag)
                         .DoStuff();

            Console.WriteLine(result);


            // factory using Func<>
            var features = FeatureFunctions <Func <string, int, string> >
                           .Create(new NewFeature().ProcessSomeData,
                                   new NewFeature().ProcessSomeDataV2);

            result = FeatFactory.FuncFactory(features, Constants.FeatFlag == "mycoolFlag")("foo", 1);

            Console.WriteLine(result);
        }
Exemple #2
0
        public void FeatFactory_ShouldBeV1()
        {
            var feat = FeatFactory.GetFeatureImplementation(Constants.FeatFlag);

            Assert.IsTrue(feat.GetType() == typeof(FeatureV1));
        }
Exemple #3
0
        public void FeatFactory_ShouldBeV2()
        {
            var feat = FeatFactory.GetFeatureImplementation("");

            Assert.IsTrue(feat.GetType() == typeof(FeatureV2));
        }