public async Task CreateMyFoo(MyFoo myFoo) { var request = new CreateMyFooRequest { FirstName = myFoo.FirstName, LastName = myFoo.LastName, }; await Service.CreateMyFooAsync(request); }
public static void WriteFoo(this GeneratedFoo foo, string p) { MyFoo derived = foo as MyFoo; if (derived != null) { derived.Write(p); } else { foo.Write(p); } }
static void EsTipo() { var cadena = "\nEl alcance de\n\tla gata comelona.".ToUpper(); var longitud = cadena.Length; if (cadena is string) { Console.WriteLine("{0} es string: {1}", cadena, cadena.GetType()); } if (longitud is int) { Console.WriteLine("{0} es int: {1}", longitud, longitud.GetType()); } object obj = new object(); var booleano = false; if (obj is object) { booleano = true; } Console.WriteLine("{0}", booleano); MyFoo foo = obj as MyFoo; try { foo = new MyFoo(); foo.Nombre = "El general Arteaga."; Console.WriteLine("{0}", foo); }catch (Exception ex) { Console.WriteLine("El error es:\n\t {0}", ex.Message); } try { Console.WriteLine("{0} : {1}", foo, foo.GetType()); }catch (Exception ex) { Console.WriteLine("El error es:\n\t {0}", ex.Message); } if (foo != null) { if (obj is MyFoo) { MyFoo foo2 = (MyFoo)obj; Console.WriteLine("{0} es {1}", foo2, foo2.GetType()); } } }
//==== /// @fn public string MyMethod(string vintCount, out string rstrMessage) /// @author Trevor Ratliff /// @date 2012-06-21 /// @param vintCount -- change the counter to this value /// @param[out] rstrMessage -- message to return to calling code /// @returns string /// @brief test of method comments // // Definitions: // lstrReturn -- value to return to calling code // /// @verbatim /// History: Date | Programmer | Contact | Description | /// 2012-06-21 | Trevor Ratliff | [email protected] | /// function creation | /// @endverbatim //==== public string MyMethod(string vintCount, out string rstrMessage) { string lstrReturn = ""; MyClass lobjClass = new MyClass(); MyFoo lobjFoo = new MyFoo(); //---- // do stuff here //---- lobjClass.MyMethod(); lobjFoo.MyFooMethod(); return(lstrReturn); }
public void LifetimeStrategyUsesFactoryToGetLifetimePolicyForGenericType() { MockBuilderContext context = CreateContext(); context.PersistentPolicies.Set <ILifetimeFactoryPolicy>( new LifetimeFactoryPolicy <RecoverableLifetime>(), typeof(MyFoo <>)); context.ExecuteBuildUp(typeof(MyFoo <string>), null); MyFoo <string> stringFoo = (MyFoo <string>)context.Existing; context.ExecuteBuildUp(typeof(MyFoo <int>), null); MyFoo <int> intFoo = (MyFoo <int>)context.Existing; ILifetimePolicy stringLifetime = context.Policies.GetNoDefault <ILifetimePolicy>(typeof(MyFoo <string>), false); ILifetimePolicy intLifetime = context.Policies.GetNoDefault <ILifetimePolicy>(typeof(MyFoo <int>), false); Assert.IsNotNull(stringLifetime); Assert.IsNotNull(intLifetime); Assert.IsInstanceOfType(stringLifetime, typeof(RecoverableLifetime)); Assert.IsInstanceOfType(intLifetime, typeof(RecoverableLifetime)); Assert.AreNotSame(stringLifetime, intLifetime); }
public void SetTo(int value) { MyFoo = Context.State.Retrieve <MyFoo>(); RunningTotal = value; }
public override void SetUp() { MyFoo = new MyFoo(); Context.State.Store(MyFoo); }
public static void Main() { A aa = new A(1, 2, 3); if (aa.a != 1) { throw new ApplicationException("error"); } aa.a = 3; if (aa.a != 3) { throw new ApplicationException("error"); } if (aa.b != 2) { throw new ApplicationException("error"); } aa.b = 5; if (aa.b != 5) { throw new ApplicationException("error"); } if (aa.d != aa.b) { throw new ApplicationException("error"); } if (aa.c != 3) { throw new ApplicationException("error"); } //aa.c = 5; //if (aa.c != 3) // throw new ApplicationException("error"); Param_i pi = new Param_i(7); if (pi.value != 7) { throw new ApplicationException("error"); } pi.value = 3; if (pi.value != 3) { throw new ApplicationException("error"); } B b = new B(aa); if (b.a.c != 3) { throw new ApplicationException("error"); } // class/struct attribute with get/set methods using return/pass by reference MyFoo myFoo = new MyFoo(); myFoo.x = 8; MyClass myClass = new MyClass(); myClass.Foo = myFoo; if (myClass.Foo.x != 8) { throw new ApplicationException("error"); } // class/struct attribute with get/set methods using return/pass by value MyClassVal myClassVal = new MyClassVal(); if (myClassVal.ReadWriteFoo.x != -1) { throw new ApplicationException("error"); } if (myClassVal.ReadOnlyFoo.x != -1) { throw new ApplicationException("error"); } myClassVal.ReadWriteFoo = myFoo; if (myClassVal.ReadWriteFoo.x != 8) { throw new ApplicationException("error"); } if (myClassVal.ReadOnlyFoo.x != 8) { throw new ApplicationException("error"); } // string attribute with get/set methods using return/pass by value MyStringyClass myStringClass = new MyStringyClass("initial string"); if (myStringClass.ReadWriteString != "initial string") { throw new ApplicationException("error"); } if (myStringClass.ReadOnlyString != "initial string") { throw new ApplicationException("error"); } myStringClass.ReadWriteString = "changed string"; if (myStringClass.ReadWriteString != "changed string") { throw new ApplicationException("error"); } if (myStringClass.ReadOnlyString != "changed string") { throw new ApplicationException("error"); } }
public static void Main() { A aa = new A(1,2,3); if (aa.a != 1) throw new ApplicationException("error"); aa.a = 3; if (aa.a != 3) throw new ApplicationException("error"); if (aa.b != 2) throw new ApplicationException("error"); aa.b = 5; if (aa.b != 5) throw new ApplicationException("error"); if (aa.d != aa.b) throw new ApplicationException("error"); if (aa.c != 3) throw new ApplicationException("error"); //aa.c = 5; //if (aa.c != 3) // throw new ApplicationException("error"); Param_i pi = new Param_i(7); if (pi.value != 7) throw new ApplicationException("error"); pi.value=3; if (pi.value != 3) throw new ApplicationException("error"); B b = new B(aa); if (b.a.c != 3) throw new ApplicationException("error"); // class/struct attribute with get/set methods using return/pass by reference MyFoo myFoo = new MyFoo(); myFoo.x = 8; MyClass myClass = new MyClass(); myClass.Foo = myFoo; if (myClass.Foo.x != 8) throw new ApplicationException("error"); // class/struct attribute with get/set methods using return/pass by value MyClassVal myClassVal = new MyClassVal(); if (myClassVal.ReadWriteFoo.x != -1) throw new ApplicationException("error"); if (myClassVal.ReadOnlyFoo.x != -1) throw new ApplicationException("error"); myClassVal.ReadWriteFoo = myFoo; if (myClassVal.ReadWriteFoo.x != 8) throw new ApplicationException("error"); if (myClassVal.ReadOnlyFoo.x != 8) throw new ApplicationException("error"); // string attribute with get/set methods using return/pass by value MyStringyClass myStringClass = new MyStringyClass("initial string"); if (myStringClass.ReadWriteString != "initial string") throw new ApplicationException("error"); if (myStringClass.ReadOnlyString != "initial string") throw new ApplicationException("error"); myStringClass.ReadWriteString = "changed string"; if (myStringClass.ReadWriteString != "changed string") throw new ApplicationException("error"); if (myStringClass.ReadOnlyString != "changed string") throw new ApplicationException("error"); }
public override void SetUp(ITestContext context) { MyFoo = new MyFoo(); context.Store(MyFoo); }
public void SetTo(int value) { MyFoo = Retrieve<MyFoo>(); RunningTotal = value; }
public void SetTo(int value) { MyFoo = Context.State.Retrieve<MyFoo>(); RunningTotal = value; }
public Task CreateMyFoo(MyFoo myFoo) { throw new System.NotImplementedException(); }