Пример #1
0
 private static CompatibleObject Map(Adaptee.IncompatibleObject @object)
 {
     return new CompatibleObject
     {
         DateTime = new DateTime(@object.Year, @object.Month, @object.Day, new GregorianCalendar())
     };
 }
Пример #2
0
        public void Tests()
        {
            var component = new Adaptee();
            var adapter = new DesignPatterns.Structural.Adapter.Adapter(component);
            var client = new Client(adapter);

            CompatibleObject result = client.Invoke(new CompatibleObject {DateTime = new DateTime(2000, 1, 1)});

            Assert.That(result.DateTime, Is.EqualTo(new DateTime(1, 6, 24)));
        }
Пример #3
0
 public Adapter(Adaptee component)
 {
     _component = component;
 }
Пример #4
0
 public Adapter(Adaptee adaptee)
 {
     m_Adaptee = adaptee;
 }
Пример #5
0
 public Adapter(Adaptee component)
 {
     _component = component;
 }
Пример #6
0
 public Adapter(Adaptee adaptee)
 {
     this._adaptee = adaptee;
 }