public void When_AddFluent_is_used_with_element_Then_element_is_added_and_collection_is_returned() { int element = 10; var list = new List <int>(); Assert.That(CollectionExtensions.Add(list, element), Is.EqualTo(list)); Assert.That(list.FirstOrDefault(), Is.EqualTo(element)); }
public static void Patch_Pawn_GetGizmos_Postfix( ref Pawn __instance, ref IEnumerable <Gizmo> __result) { if (__instance.health == null || !((HediffSet)((Pawn_HealthTracker)__instance.health).hediffSet).HasHediff(MFHediffDefOf.MFBastionHigh, false) || Find.get_Selector().get_NumSelected() != 1) { return; } ShieldHediff firstHediffOfDef = ((HediffSet)((Pawn_HealthTracker)__instance.health).hediffSet).GetFirstHediffOfDef(MFHediffDefOf.MFBastionHigh, false) as ShieldHediff; __result = (IEnumerable <Gizmo>)CollectionExtensions.Add <Gizmo>((IEnumerable <M0>)__result, (M0) new Gizmo_ShieldHediff() { shield = firstHediffOfDef }); }
public static void Postfix(Pawn __instance, ref IEnumerable <Gizmo> __result) { bool flag = __instance != null && __instance.def.HasComp(typeof(CompVehicle)); if (flag) { Command_Action command_Action = new Command_Action { icon = ContentFinder <Texture2D> .Get("UI/Commands/LoadTransporter", true), defaultLabel = "LoadItems".Translate(), defaultDesc = "LoadItemsToVehicle".Translate(), activateSound = SoundDef.Named("Click"), action = delegate() { Find.WindowStack.Add(new Dialog_LoadItemsToVehicle(__instance)); } }; __result = CollectionExtensions.Add <Gizmo>(__result, command_Action); } }