public void ReturnsValidObj() { // The safe wrapper should overwrite the valid object with default(obj1) obj1 o1 = null; Assert.DoesNotThrow(() => { o1 = WrapErr.SafeAction(() => { return(new obj1()); }); }); Assert.IsNotNull(o1); }
public void DefaultObjectOnThrow() { // The safe wrapper should overwrite the valid object with default(obj1) obj1 o1 = new obj1(); Assert.DoesNotThrow(() => { o1= WrapErr.SafeAction(() => { string s2 = null; string s3 = s2.Substring(0, 10); return new obj1(); }); }); Assert.AreEqual(o1, default(obj1)); Assert.IsNull(o1); }
public void DefaultObjectOnThrow() { // The safe wrapper should overwrite the valid object with default(obj1) obj1 o1 = new obj1(); Assert.DoesNotThrow(() => { o1 = WrapErr.SafeAction(() => { string s2 = null; string s3 = s2.Substring(0, 10); return(new obj1()); }); }); Assert.AreEqual(o1, default(obj1)); Assert.IsNull(o1); }
static void Main(string[] args) { int opcion; Class1 obj1 = new obj1(); Class1 obj2 = new obj2(); Class1 obj3 = new obj3(); Class1 obj4 = new obj4(); Console.WriteLine("***MENU DE OPCIONES***"); Console.WriteLine("Para multiplicar ingrese 1"); Console.WriteLine("Para dividir ingrese 2"); Console.WriteLine("Para ingresar nombres digite 3"); Console.WriteLine("Para ingresar edades digite 4"); opcion = int.Parse(Console.ReadLine()); switch : {
public bool SendNotification(obj1 obj) { var sender = new SendSMS(); return(sender.Send(obj)); }
if (ReferenceEquals(obj1, obj2)) { return(true);
EnumerateMembers(obj1, obj2, type.BaseType, fields, properties, methods, name);
return(Equals(obj1, obj2));