static void Main(string [] args) { Inheritor inh = new Inheritor(); inh.info1(); inh.info2(); inh.info3(); }
public void ReflectionExtension_can_find_methods_from_base_classes() { // all classes inherits from Object and Object has ToString() method! var instance = new Inheritor(); var method = instance.GetType().FindMethodRecursively("ToString"); Assert.NotNull(method); }
public void ReflectionExtension_throws_when_unable_to_find_method() { // all classes inherits from Object and Object has ToString() method! var instance = new Inheritor(); var exception = Record.Exception(() => instance.GetType().FindMethodRecursively("IfThisIsHereStuffIsWhack")); Assert.NotNull(exception); var argumentException = Assert.IsType <ArgumentException>(exception); Assert.Equal("name", argumentException.ParamName); }
public Settler.Settler GenerateChild(Varsk father, Varsk mother) { int minParentAge = Math.Min(-1 * father.Birthday.DaysSinceSettlement, -1 * mother.Birthday.DaysSinceSettlement); int age = new Random().Next(minParentAge - Varsk.VarskAdultYears * Date.DaysInYear); bool isMale = new Random().Next(2) == 0; NameFactory name = isMale ? VarskNameFactories.Male() : VarskNameFactories.Female(); var child = new Varsk(new Date(-1 * age), name.Generate(), $"{(father.PrestigeLevel >= mother.PrestigeLevel ? father.GivenName : mother.GivenName)}sson", isMale ? BinaryGender.Male : BinaryGender.Female); ParentChildRelationship.Make(_manager, 0, father, child); ParentChildRelationship.Make(_manager, 0, mother, child); Inheritor.GenerateChildTraits(child); return(child); }
public Client() { var obj = Inheritor.Create(); }