Operation() public méthode

public Operation ( ) : void
Résultat void
Exemple #1
0
        static void BridgeTester()
        {
            #region sample 1

            var ab = new RefinedAbstraction {
                Implementor = new ConcreteImplementorA()
            };
            // Set implementation and call
            ab.Operation();

            // Change implemention and call
            ab.Implementor = new ConcreteImplementorB();
            ab.Operation();
            #endregion

            #region sample 2

            var customers = new Customers("Chicago")
            {
                Data = new CustomersData()
            };

            // Set ConcreteImplementor

            // Exercise the bridge
            customers.Show();
            customers.Next();
            customers.Show();
            customers.Next();
            customers.Show();
            customers.Add("Henry Velasquez");

            customers.ShowAll();
            #endregion
        }
Exemple #2
0
    static void Main()
    {
        Abstraction abstraction;

        abstraction = new RefinedAbstraction(new ConcreteImplementorA());
        abstraction.Operation();
        abstraction.Implementor = new ConcreteImplementorB();
        abstraction.Operation();
    }
        public void Check_Bridge()
        {
            Abstraction ab = new RefinedAbstraction();

            ab.Implementor = new SP_Bridge.ConcreteImplementorA();
            ab.Operation();
            ab.Implementor = new SP_Bridge.ConcreteImplementorB();
            ab.Operation();
        }
        static void Main(string[] args)
        {
            Abstraction ab = new RefinedAbstraction();

            ab.SetImplementor(new ConcreteImplementorA());
            ab.Operation();

            ab.SetImplementor(new ConcreteImplementorB());
            ab.Operation();
        }
Exemple #5
0
        public void TestMethodBridge()
        {
            AbstractionBridge ab = new RefinedAbstraction();

            ab.Implementor = new ConcreteImplementorBridgeA();
            ab.Operation();

            ab.Implementor = new ConcreteImplementorBridgeB();
            ab.Operation();
        }
Exemple #6
0
    static void Main()
    {
        Abstraction ab = new RefinedAbstraction();

        ab.SetImplementor(new ConcreteImplementorA());
        ab.Operation();
        ab.SetImplementor(new ConcreteImplementorB());
        ab.Operation();
        Console.ReadKey();
    }
Exemple #7
0
        public static void TestBridgeAbstraction()
        {
            Abstraction ab = new RefinedAbstraction();

            ab.Implementor = new ConcreteImplementorA();
            StringAssert.AreEqualIgnoringCase(ab.Operation(true), "ConcreteImplementorA Operation");

            ab.Implementor = new ConcreteImplementorB();
            StringAssert.AreEqualIgnoringCase(ab.Operation(true), "ConcreteImplementorB Operation");
        }
Exemple #8
0
        public static void BridgePattern()
        {
            Abstraction ab = new RefinedAbstraction();

            ab.SetImplementor(new ConcreteImplementorA());
            ab.Operation();
            ab.SetImplementor(new ConcreteImplementorB());
            ab.Operation();

            Console.Read();
        }
        public static void BridgeStructural()
        {
            Abstraction ab = new RefinedAbstraction();

            // Set implementation and call
            ab.Implementor = new ConcreteImplementorA();
            ab.Operation();

            // Change implemention and call
            ab.Implementor = new ConcreteImplementorB();
            ab.Operation();
        }
 static void Main()
 {
     Abstraction ab = new RefinedAbstraction();
     // Set implementation and call 
     ab.Implementor = new ConcreteImplementorA();
     ab.Operation();
     // Change implemention and call 
     ab.Implementor = new ConcreteImplementorB();
     ab.Operation();
     // Wait for user 
     Console.Read();
 }
            static void Main()
            {
                Abstraction ab = new RefinedAbstraction();

                // Set implementation and call
                ab.Implementor = new ConcreteImplementorA();
                ab.Operation();
                // Change implemention and call
                ab.Implementor = new ConcreteImplementorB();
                ab.Operation();
                Console.ReadKey();
            }
Exemple #12
0
    void Start( )
    {
        Abstraction ab = new RefinedAbstraction();

        // Set implementation and call
        ab.Implementor = new ConcreteImplementorA();
        ab.Operation();

        // Change implemention and call
        ab.Implementor = new ConcreteImplementorB();
        ab.Operation();
    }
Exemple #13
0
        public static void Create()
        {
            var ab = new RefinedAbstraction();

            // Set initial implementation.
            ab.Implementor = new ConcreteImplementorA();
            ab.Operation();

            // Replace the implementation with a different one (within the same object).
            ab.Implementor = new ConcreteImplementorB();
            ab.Operation();
        }
        public void TestOperation()
        {
            Abstraction ab = new RefinedAbstraction();

            // Set implementation and call
            ab.Implementor = new ConcreteImplementationOne();
            Assert.AreNotEqual(ab.Operation(), "asdf");

            // Change implemention and call
            ab.Implementor = new ConcreteImplementationTwo();
            Assert.AreEqual(ab.Operation(), "ConcreteImplementationTwo Operation");
        }
Exemple #15
0
        static void Main(string[] args)
        {
            Abstraction abstraction = new RefinedAbstraction();

            abstraction.Implementor = new ConcreteImplementorA();
            abstraction.Operation();

            abstraction.Implementor = new ConcreteImplementorB();
            abstraction.Operation();

            Console.Read();
        }
  public static void Main( string[] args )
  {
    Abstraction abstraction = new RefinedAbstraction();

    // Set implementation and call
    abstraction.Implementor = new ConcreteImplementorA();
    abstraction.Operation();

    // Change implemention and call
    abstraction.Implementor = new ConcreteImplementorB();
    abstraction.Operation();

  }
        /// <summary>
        /// Entry point into console application.
        /// </summary>
        public void Run()
        {
            var ab = new RefinedAbstraction
            {
                // Set implementation and call
                Implementor = new ConcreteImplementorA()
            };

            ab.Operation();

            // Change implemention and call
            ab.Implementor = new ConcreteImplementorB();
            ab.Operation();
        }
Exemple #18
0
        public void TestMethod1()
        {
            Abstraction ab = new RefinedAbstraction();

            // Set implementation and call

            ab.Implementor = new ConcreteImplementorA();
            ab.Operation();

            // Change implemention and call

            ab.Implementor = new ConcreteImplementorB();
            ab.Operation();
        }
        // "Abstraction"
        public void TestBridgePattern()
        {
            Abstraction ab = new RefinedAbstraction();

            // Set implementation and call
            ab.Implementor = new ConcreteImplementorA();
            ab.Operation();

            // Change implemention and call
            ab.Implementor = new ConcreteImplementorB();
            ab.Operation();

            // Wait for user
            Console.Read();
        }
Exemple #20
0
        /// <summary>
        /// Entry point into console application.
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            Abstraction ab = new RefinedAbstraction();

            // Set implementation and call
            ab.SetImplementor(new ConcreteImplementorA());
            ab.Operation();

            // Change implemention and call
            ab.SetImplementor(new ConcreteImplementorB());
            ab.Operation();

            // Wait for user
            Console.ReadKey();
        }
        public Client()
        {
            IImplementor concreateImplementor = new ConcreateImplementor();
            Abstraction  abstraction          = new RefinedAbstraction(concreateImplementor);

            abstraction.Operation();
        }
Exemple #22
0
        //Міст - Bridge
        public Run Bridge()
        {
            Console.WriteLine("\nBridge:");

            Abstraction ab = new RefinedAbstraction();

            // Set implementation and call
            ab.Implementor = new ConcreteImplementorA();
            ab.Operation();

            // Change implementation and call
            ab.Implementor = new ConcreteImplementorB();
            ab.Operation();

            return(this);
        }
Exemple #23
0
        public static void Test()
        {
            var refinedAbstraction = new RefinedAbstraction();
            refinedAbstraction.implementor = new ConcreteImplementor();

            refinedAbstraction.Operation();
        }
Exemple #24
0
    public static void Main()
    {
        Abstraction ra = new RefinedAbstraction();

        ra.Operation();

        Console.ReadKey();
    }
        private static void BridgeExample()
        {
            var abstraction = new RefinedAbstraction
            {
                Implementor = new ConcreteImplementor()
            };

            abstraction.Operation();
        }
Exemple #26
0
        static void Main(string[] args)
        {
            //추상층
            Abstraction ab = new RefinedAbstraction();


            //구현층
            ab.Implementor = new ConcreteImplementorA();
            ab.Operation();

            ab.Implementor = new ConcreteImplementorB();
            ab.Operation();

            //Abstraction안의 Implementor를 쓰면되서 Implementor를 만들필요가 없다.
            //Abstraction를 통해서 선언만 함으로서 Implementor 사용가능하다.
            //다른 것도 선언만 함으로써 사용하고 싶다면 Abstraction안에 추가해주면됨 (추상층과 구현층이 분리되어있기 때문)
            //이것이 구현층과 추상층이 분리되어있는 패턴인 브릿지패턴
        }
Exemple #27
0
        static void Main(string[] args)
        {
            Abstraction ab = new RefinedAbstraction();

            // Set implementation and call
            ab.Implementor = new ConcreteImplementorA();
            ab.Operation();

            // Change implemention and call
            ab.Implementor = new ConcreteImplementorB();
            ab.Operation();


            // example 2
            var bridge1 = new Bridge1();
            var ab1     = new AbstractBridge(bridge1);

            ab1.CallMethod1();
            ab1.CallMethod2();

            var bridge2 = new Bridge2();
            var ab2     = new AbstractBridge(bridge2);

            ab2.CallMethod1();
            ab2.CallMethod2();

            // example 3
            var customers = new Customers();

            // Set ConcreteImplementor
            customers.DataObject = new CustomersData {
                City = "Chicago"
            };

            // Exercise the bridge
            customers.Show();
            customers.Next();
            customers.Show();
            customers.Next();
            customers.Show();

            customers.Add("Bob Dole");
            customers.ShowAll();
        }
Exemple #28
0
        public UseCase()
        {
            Abstraction abstraction;

            abstraction = new RefinedAbstraction(new ConcreteImplementorOne());
            abstraction.Operation();

            abstraction = new RefinedAbstraction(new ConcreteImplementorTwo());
            abstraction.Operation();
        }
        public void TestBridge()
        {
            IImplementation implementer = new ConcreteImplementation();

            var abstraction = new RefinedAbstraction(implementer);

            var result = abstraction.Operation();

            Assert.AreEqual(result, "Test");
        }
Exemple #30
0
        public void CallBridgeConcreteImplementor()
        {
            Abstraction abstraction = new RefinedAbstraction();

            // Set implementation
            abstraction.Imp = new ConcreteImplementorA();
            // Call operation
            string result = abstraction.Operation();

            Assert.AreEqual(result, "ConcreteImplementorA");
        }
        private static void ShowBridge()
        {
            Console.WriteLine("================================================");
            Console.WriteLine("Pattern code (Bridge):");
            Abstraction ab = new RefinedAbstraction();

            ab.Implementor = new ConcreteImplementorA();
            ab.Operation();
            ab.Implementor = new ConcreteImplementorB();
            ab.Operation();

            Console.WriteLine("\nReal code (Bridge):");
            Programmer freelancer = new FreelanceProgrammer(new CppLanguage());

            freelancer.DoWork();
            freelancer.EarnMoney();
            freelancer.Language = new CSharpLanguage();
            freelancer.DoWork();
            freelancer.EarnMoney();
        }
Exemple #32
0
        private void DoTest(AbstractImplementor imp, int expectedResult)
        {
            RefinedAbstraction obj = new RefinedAbstraction(imp);

            Assert.AreEqual(expectedResult, obj.Operation());
        }