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 }
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(); }
public void TestMethodBridge() { AbstractionBridge ab = new RefinedAbstraction(); ab.Implementor = new ConcreteImplementorBridgeA(); ab.Operation(); ab.Implementor = new ConcreteImplementorBridgeB(); ab.Operation(); }
static void Main() { Abstraction ab = new RefinedAbstraction(); ab.SetImplementor(new ConcreteImplementorA()); ab.Operation(); ab.SetImplementor(new ConcreteImplementorB()); ab.Operation(); Console.ReadKey(); }
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"); }
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(); }
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(); }
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"); }
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(); }
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(); }
/// <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(); }
//Міст - 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); }
public static void Test() { var refinedAbstraction = new RefinedAbstraction(); refinedAbstraction.implementor = new ConcreteImplementor(); refinedAbstraction.Operation(); }
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(); }
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안에 추가해주면됨 (추상층과 구현층이 분리되어있기 때문) //이것이 구현층과 추상층이 분리되어있는 패턴인 브릿지패턴 }
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(); }
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"); }
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(); }
private void DoTest(AbstractImplementor imp, int expectedResult) { RefinedAbstraction obj = new RefinedAbstraction(imp); Assert.AreEqual(expectedResult, obj.Operation()); }