public void Sort_ArabikaAndSomethingAndLG_LGReturned() { //Arrange KitchenUnit kitchenUnitToTest = new KitchenUnit("Arabika", "Something", 1600, 1000, 12); WashingMachine washingMachineToTest = new WashingMachine("Something", "Arabika", 700, 12, 6); VacuumCleaner vacuumCleanerToTest = new VacuumCleaner("LG", "Samsung", 1500, "Blue", 1600); List <Appliance> expectedList = new List <Appliance> { kitchenUnitToTest, vacuumCleanerToTest, washingMachineToTest, }; //Act List <Appliance> actualList = new List <Appliance> { washingMachineToTest, vacuumCleanerToTest, kitchenUnitToTest }; Controller.Sort(actualList); //Assert Assert.AreEqual(expectedList.ElementAt(1).Name, actualList.ElementAt(1).Name); }
public async Task <IActionResult> AddWashingMachine(WashingMachine model) { var laundryId = model.LaundryId; var machinePosition = model.Position; var laundry = _laundryRepo.GetLaundryById(laundryId); if (!await _authHelpers.CheckDormitoryMembership(User, laundry.Dormitory)) { return(ControllerHelpers.ShowAccessDeniedErrorPage(this)); } if (_washingMachineRepo.WashingMachines.Any(x => x.Position == machinePosition && x.LaundryId == laundryId)) { var dayViewModel = CreateDayViewModel(laundry.DormitoryId, DateTime.Today); dayViewModel.AddWashingMachineError = "There is washing machine with the same number in this laundry."; dayViewModel.WashingMachineToAdd = new WashingMachine { Position = laundry.Position, LaundryId = laundryId }; return(View(nameof(Day), dayViewModel)); } var machine = _washingMachineRepo.AddWashingMachine(laundryId, machinePosition); return(RedirectToDayByLaundryId(machine.LaundryId, DateTime.Now.Date)); }
public void FindApplianceByManufacturer_ArabikaAndSomethingAndSamsung_SamsungReturned() { //Arrange KitchenUnit kitchenUnitToTest = new KitchenUnit("Arabika", "Something", 1600, 1000, 12); WashingMachine washingMachineToTest = new WashingMachine("Something", "Arabika", 700, 12, 6); VacuumCleaner vacuumCleanerToTest = new VacuumCleaner("LG", "Samsung", 1500, "Blue", 1600); string expectedValue = "Samsung"; //Act List <Appliance> appliances = new List <Appliance> { kitchenUnitToTest, washingMachineToTest, vacuumCleanerToTest }; List <Appliance> actualObject = new List <Appliance>(); actualObject.AddRange(Controller.FindApplianceByManufacturer(appliances, vacuumCleanerToTest.Manufacturer)); string actualValue = ""; foreach (var a in actualObject) { actualValue = a.Manufacturer; } //Assert Assert.AreEqual(expectedValue, actualValue); }
public WashingMachineViewModel(WashingMachine machine) { this.Id = machine.Id; this.ProductName = machine.ProductName; this.Model = machine.Model; this.WashingCapacity = machine.WashingCapacity; this.Price = machine.Price; this.Picture = machine.Picture; }
protected override void Start() { spriteRenderer = GetComponent <SpriteRenderer>(); //Find a Dryer or WashingMachine to track capacity //Yes I know Dryer and WashingMachine should inherit from a parent Machine class since //they're so similar and it would simplify the code a lot, but too late, and too bad! washingMachine = GetComponentInParent <WashingMachine>(); dryer = GetComponentInParent <Dryer>(); }
// Start is called before the first frame update void Start() { washingMachine = GetComponentInParent <WashingMachine>(); animatedTransform = washingMachine.animator.transform; idleAnimatedTransformPos = animatedTransform.transform.localPosition; idleAnimatedTransformRot = animatedTransform.transform.localRotation; initialLocalPos = transform.localPosition; initialLocalRot = transform.localRotation; }
static void Main(string[] args) { var machine = new WashingMachine(true, false, false, false, false, false, 40, 1200, true, true); machine.StartWashing(); Thread.Sleep(5000); machine.StopWashing(); Console.Read(); }
public override bool Run() { WashingMachine closestObject = GlobalFunctions.GetClosestObject <WashingMachine>((IEnumerable <WashingMachine>) this.Target.LotCurrent.GetObjects <WashingMachine>(), (IGameObject)this.Target, new Predicate <WashingMachine>(Hamper.DoLaundry.IsWashingMachineUsable)); if (closestObject == null) { return(false); } this.Actor.InteractionQueue.PushAsContinuation(Hamper.PickUp.Singleton, (IGameObject)this.Target, true); this.Actor.InteractionQueue.PushAsContinuation(WashingMachine.DoLaundry.Singleton, (IGameObject)closestObject, true); return(true); }
public void RemoveWashingMachine(WashingMachine washingMachine) { if (washingMachine == null) { return; } var machine = washingMachine; washingMachine = _context.WashingMachines .Single(x => x.Id == machine.Id); _context.WashingMachines.Remove(washingMachine); _context.SaveChanges(); }
public ShoppingCart FillCartWithWashingMachine(string washingMichineId, WashingMachine washingMachine, User currentUser, string userId, decimal?newPriceWashingMachine) { return(new ShoppingCart { WashingMachineId = washingMichineId, WashingMachines = washingMachine, User = currentUser, UserId = userId, AddTOCart = DateTime.Now, TotalPrice = newPriceWashingMachine, }); }
public static void Main() { RemoteControl remoteControl = new RemoteControl(); Light light = new Light(); Ac ac = new Ac(); WashingMachine washingMachine = new WashingMachine(); remoteControl.SetCommand(0, new LightOnCommand(light), new LightOffCommand(light)); remoteControl.SetCommand(1, new AcOnCommand(ac, 25), new AcOffCommand(ac, 25)); remoteControl.SetCommand(2, new WashingMachingOnCommand(washingMachine, 10), new WashingMachingOffCommand(washingMachine, 10)); /* * ON OFF * * 0 0 Slot1 Light * 1 1 Slot2 Ac * 2 2 Slot3 WashingMachine * 3 3 Slot4 Empty * 4 4 Slot5 Empty * */ string type; int index; while (true) { Console.WriteLine("****Remote Control********\n"); Console.WriteLine("On or Off or Undo : "); type = Console.ReadLine(); Console.WriteLine("Enter index : "); index = Convert.ToInt32(Console.ReadLine()); if (type == "On") { remoteControl.ButtonOnPressed(index); } if (type == "Off") { remoteControl.ButtonOffPressed(index); } if (type == "Undo") { remoteControl.UndoButtonPressed(); } } }
public override bool Run() { this.mClothingPile = this.Actor.GetObjectInRightHand() as ClothingPileWet; if (mClothingPile == null) { ClothingPileWet closestObject1 = GlobalFunctions.GetClosestObject <ClothingPileWet>((IEnumerable <ClothingPileWet>) this.Target.LotCurrent.GetObjects <ClothingPileWet>(), (IGameObject)this.Target); if (closestObject1 != null) { this.Actor.InteractionQueue.PushAsContinuation(ClothingPileWet.DryClothesInDryer.Singleton, (IGameObject)closestObject1, true); return(true); } WashingMachine closestObject2 = GlobalFunctions.GetClosestObject <WashingMachine>((IEnumerable <WashingMachine>) this.Target.LotCurrent.GetObjects <WashingMachine>(), (IGameObject)this.Target, new Predicate <WashingMachine>(WashingMachineDoLaundryEx.IsWashingDone)); if (closestObject2 != null) { this.Actor.InteractionQueue.PushAsContinuation(WashingMachine.DryClothesInDryer.Singleton, (IGameObject)closestObject2, true); return(true); } return(false); } if (!this.Target.RouteToDryerAndCheckInUse((InteractionInstance)this) || this.Target.CurDryerState != Dryer.DryerState.Empty) { CarrySystem.PutDownOnFloor(this.Actor, new SacsEventHandler(this.OnPutdownAnimationEvent), 102U); return(false); } this.StandardEntry(); this.Target.mDryerStateMachine = StateMachineClient.Acquire((IHasScriptProxy)this.Target, "dryer"); StateMachineClient dryerStateMachine = this.Target.mDryerStateMachine; dryerStateMachine.SetActor("x", (IHasScriptProxy)this.Actor); dryerStateMachine.SetActor("clothesBag", (IHasScriptProxy)this.mClothingPile); dryerStateMachine.SetActor("dryer", (IHasScriptProxy)this.Target); dryerStateMachine.EnterState("x", "Enter"); dryerStateMachine.EnterState("dryer", "Enter"); dryerStateMachine.AddPersistentScriptEventHandler(0U, new SacsEventHandler(this.OnAnimationEvent)); this.BeginCommodityUpdates(); CarrySystem.ExitAndKeepHolding(this.Actor); dryerStateMachine.RequestState(false, "dryer", "Start Dryer"); dryerStateMachine.RequestState(true, "x", "Start Dryer"); this.EndCommodityUpdates(true); dryerStateMachine.RequestState(false, "dryer", "Loop Operate"); dryerStateMachine.RequestState(true, "x", "Exit Add Clothes"); Punishment.ApplyAbsolvingActionToSim(this.Actor, Punishment.AbsolvingActionType.DoingLaundry); this.StandardExit(); return(true); }
public void GetCost_1600and700_2300returned() { //Arrange KitchenUnit kitchenUnitToTest = new KitchenUnit("Arabika", "Something", 1600, 1000, 12); WashingMachine washingMachineToTest = new WashingMachine("Something", "Arabika", 700, 12, 6); double expected = 2300; //Act List <Appliance> appliances = new List <Appliance> { kitchenUnitToTest, washingMachineToTest }; double actual = Controller.GetCost(appliances); //Assert Assert.AreEqual(expected, actual); }
private static void Main() { helper.SetupConsole(); var WashPro = new WashingMachine(); for (int i = 0; i < dirtyClothes.Length; i++) { string clothes = dirtyClothes[i]; Console.WriteLine("Clothes before cleaning:"); helper.PrintColorText(string.Format("{0}\n\n", clothes), ConsoleColor.DarkMagenta); clothes = WashPro.Programs[i].DoLoundry(clothes); Console.WriteLine("\nClothes after cleaning:"); helper.PrintColorText(string.Format("{0}\n\n", clothes), ConsoleColor.DarkMagenta); Console.WriteLine("{0}", new string('-', Console.WindowWidth)); } }
public WashingMachine AddWashingMachine(int laundryId, int position) { if (_context.WashingMachines .Any(x => x.LaundryId == laundryId && x.Position == position)) { return(null); } var machine = new WashingMachine() { LaundryId = laundryId, Position = position }; _context.WashingMachines.Add(machine); _context.SaveChanges(); return(machine); }
public override bool Run() { this.mClothingPile = this.Actor.GetObjectInRightHand() as ClothingPileWet; if (mClothingPile == null) { ClothingPileWet closestObject1 = GlobalFunctions.GetClosestObject <ClothingPileWet>((IEnumerable <ClothingPileWet>) this.Target.LotCurrent.GetObjects <ClothingPileWet>(), (IGameObject)this.Target); if (closestObject1 != null) { this.Actor.InteractionQueue.PushAsContinuation(ClothingPileWet.DryClothesOnClothesline.Singleton, (IGameObject)closestObject1, true); return(true); } WashingMachine closestObject2 = GlobalFunctions.GetClosestObject <WashingMachine>((IEnumerable <WashingMachine>) this.Target.LotCurrent.GetObjects <WashingMachine>(), (IGameObject)this.Target, new Predicate <WashingMachine>(WashingMachineDoLaundryEx.IsWashingDone)); if (closestObject2 != null) { this.Actor.InteractionQueue.PushAsContinuation(WashingMachine.DryClothesOnClothesline.Singleton, (IGameObject)closestObject2, true); return(true); } return(false); } int slotIndex; if (!this.Target.RouteToClotheslineAndCheckInUse((InteractionInstance)this, out slotIndex) || this.Target.CurClothesState != Dryer.DryerState.Empty) { CarrySystem.PutDownOnFloor(this.Actor, new SacsEventHandler(this.OnPutDownAnimationEvent), 102U); return(false); } this.StandardEntry(); this.EnterStateMachine("ClothesLine", "Enter", "x", "clothesLine"); this.SetActor("clothesbag", (IHasScriptProxy)this.mClothingPile); this.SetParameter("isMirrored", slotIndex == 0); this.AddOneShotScriptEventHandler(101U, new SacsEventHandler(this.OnAnimationEvent)); this.AddOneShotScriptEventHandler(102U, new SacsEventHandler(this.OnAnimationEvent)); this.BeginCommodityUpdates(); CarrySystem.ExitAndKeepHolding(this.Actor); this.Actor.BuffManager.AddElement(BuffNames.SavingEnergy, Origin.FromClothesline, ProductVersion.EP2, TraitNames.EnvironmentallyConscious); this.AnimateSim("Exit Hang Clothes"); this.EndCommodityUpdates(true); this.StandardExit(); Punishment.ApplyAbsolvingActionToSim(this.Actor, Punishment.AbsolvingActionType.DoingLaundry); return(true); }
public override bool Test(Sim a, WashingMachine target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (target.mWashState != WashingMachine.WashState.HasCleanLaundry) { return(false); } if (!WashingMachine.DryClothesBase.DoesClotheslineExist(target.LotCurrent)) { if (!target.LotCurrent.IsCommunityLot && !WashingMachine.DryClothesBase.DoesDryerExist(target.LotCurrent)) { greyedOutTooltipCallback = new GreyedOutTooltipCallback(WashingMachine.DryClothesOnClothesline.NoClotheslinesOnLotToolTip); } return(false); } if (Clothesline.FindClosestAvailibleClothesline((GameObject)target, a) == null) { greyedOutTooltipCallback = new GreyedOutTooltipCallback(WashingMachine.DryClothesOnClothesline.NoAvailibleClotheslinesOnLot); return(false); } return(true); }
public override bool Test(Sim a, WashingMachine target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (!target.CanDoLaundry()) { return(false); } if (target.mWashState == WashingMachine.WashState.HasDirtyLaundry) { return(true); } if (a.IsSelectable && target.LotCurrent.IsCommunityLot && a.FamilyFunds < target.Tuning.kCostToOperate) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(WashingMachine.LocalizeString("InsufficientFunds")); return(false); } if (!target.LotCurrent.IsResidentialLot) { return(true); } if (Sims3.Gameplay.Queries.CountObjects <ClothingPileDry>(target.LotCurrent) > 0U) { return(true); } foreach (Hamper hamper in target.LotCurrent.GetObjects <Hamper>()) { if (hamper.HasClothingPiles()) { return(true); } } if (a.Inventory.ContainsType(typeof(ClothingPileDry), 1)) { return(true); } greyedOutTooltipCallback = new GreyedOutTooltipCallback(WashingMachine.DoLaundry.Definition.NoLaundryTooltip); return(false); }
public bool IsFaultAtTime(WashingMachine machine, DateTime time) { return(isCurrentlyFault(machine.Id) && time >= washingMachineState[machine.Id].StartTime || machine.Reservations .Any(x => x.StartTime <= time && (x.EndTime == null || x.EndTime > time) && x.Fault)); }
public static bool IsWashingDone(WashingMachine washingMachine) { return((washingMachine.mWashState == WashingMachine.WashState.HasCleanLaundry) && !washingMachine.Repairable.Broken); }
public WashingMachingOffCommand(WashingMachine washingMachine, int liters) { _washingMachine = washingMachine; _liters = liters; }
private void Start() { washingMachine = GetComponentInParent <WashingMachine>(); spriteRenderer = GetComponentInChildren <SpriteRenderer>(); }
public override bool Run() { if (this.Target.Parent != this.Actor && !(CarrySystem.PickUp(this.Actor, (ICustomCarryable)this.Target, new SacsEventHandler(this.Target.OnPickUp), 0U))) { Alive.WriteLog("Alive_debugInfo_LOG:NOT_ERROR\nCannot_Do_Laundry:cannot_pickUp_clothingPile"); return(false); } this.Actor.PlayRouteFailFrequency = Sim.RouteFailFrequency.NeverPlayRouteFail; this.BeginCommodityUpdates(); if (this.ActiveStage != null) { ClothingPileDry currentPile; do { currentPile = (this.ActiveStage as RoomVsLotStage <ClothingPileDry>).GetNext(); if (currentPile != null) { if (this.Actor.RouteToObjectRadiusAndCheckInUse((IGameObject)currentPile, currentPile.CarryRouteToObjectRadius) && currentPile.Parent == null) { this.Actor.CarryStateMachine.AddOneShotScriptEventHandler(113U, (SacsEventHandler)((A_1, A_2) => currentPile.FadeOut(false))); this.Actor.CarryStateMachine.RequestState("x", "PickUpAnother"); this.Actor.CarryStateMachine.RequestState("x", "Carry"); this.Target.AddClothingPile(currentPile); currentPile.Destroy(); } this.Actor.RemoveExitReason(ExitReason.RouteFailed | ExitReason.ObjectInUse); } }while(currentPile != null && !this.Actor.HasExitReason()); } this.Actor.PlayRouteFailFrequency = Sim.RouteFailFrequency.AlwaysPlayRouteFail; this.Stages = (List <Sims3.Gameplay.Interactions.Stage>)null; this.Actor.InteractionQueue.FireQueueChanged(); if (!this.Actor.HasExitReason()) { this.EndCommodityUpdates(true); Hamper closestObject1 = GlobalFunctions.GetClosestObject <Hamper>((IEnumerable <Hamper>)Sims3.Gameplay.Queries.GetObjects <Hamper>(this.Actor.Position, ClothingPileDry.kRadiusToConsiderHampers), (IGameObject)this.Actor, new Predicate <Hamper>(ClothingPileDry.CleanUp.DoesHamperHaveSpaceLeft)); if (closestObject1 != null) { this.Actor.InteractionQueue.PushAsContinuation(Hamper.DropClothes.Singleton, (IGameObject)closestObject1, true); return(true); } if (!this.Autonomous || !this.Target.LotCurrent.LaundryManager.GivesFreshClothingBuff) { WashingMachine closestObject2 = GlobalFunctions.GetClosestObject <WashingMachine>((IEnumerable <WashingMachine>)Sims3.Gameplay.Queries.GetObjects <WashingMachine>(this.Actor.LotCurrent), (IGameObject)this.Actor, new Predicate <WashingMachine>(ClothingPileDry.CleanUp.IsWashingMachineUsable)); if (closestObject2 != null) { this.Actor.InteractionQueue.PushAsContinuation(WashingMachine.DoLaundry.SingletonNoStages, (IGameObject)closestObject2, true); return(true); } } Hamper closestObject3 = GlobalFunctions.GetClosestObject <Hamper>((IEnumerable <Hamper>)Sims3.Gameplay.Queries.GetObjects <Hamper>(this.Actor.LotCurrent), (IGameObject)this.Actor); if (closestObject3 != null) { this.Actor.InteractionQueue.PushAsContinuation(Hamper.DropClothes.Singleton, (IGameObject)closestObject3, true); return(true); } WashingMachine closestObject4 = GlobalFunctions.GetClosestObject <WashingMachine>((IEnumerable <WashingMachine>)Sims3.Gameplay.Queries.GetObjects <WashingMachine>(this.Actor.LotCurrent), (IGameObject)this.Actor); if (closestObject4 == null) { return(this.Target.PutInInventory(this.Actor)); } this.Actor.InteractionQueue.PushAsContinuation(WashingMachine.DoLaundry.SingletonNoStages, (IGameObject)closestObject4, false); return(true); } Alive.WriteLog("Alive_debugInfo_LOG:NOT_ERROR\nCannot_Do_Laundry:this.Actor.HasExitReason():" + this.Actor.ExitReason); this.EndCommodityUpdates(false); return(false); }
protected override void PrivatePerformAction(bool prompt) { try { Overwatch.Log("Cleanup Laundromat"); foreach (Lot lot in LotManager.AllLots) { if (!Allow(lot)) { continue; } foreach (GameObject obj in lot.GetObjects <GameObject>()) { WashingMachine washing = obj as WashingMachine; if (washing != null) { if (washing.mWashState != WashingMachine.WashState.Empty) { Overwatch.Log("Washer Emptied"); washing.SetObjectToReset(); washing.RemoveClothes(); } } else { Dryer dryer = obj as Dryer; if (dryer != null) { if (dryer.CurDryerState != Dryer.DryerState.Empty) { Overwatch.Log("Dryer Emptied"); dryer.ForceDryerDone(); dryer.TakeClothes(false); dryer.SetGeometryState("empty"); } } else { Clothesline line = obj as Clothesline; if (line != null) { if (line.CurClothesState != Dryer.DryerState.Empty) { Overwatch.Log("Line Emptied"); if (line.mDripFX == null) { line.StartDrying(); } line.ForceClothesDry(); line.ClothesTaken(); } } } } } } if (prompt) { Overwatch.AlarmNotify(Common.Localize("CleanupLaundromat:Complete")); } } catch (Exception e) { Common.Exception(Name, e); } }
protected override void Start() { base.Start(); washingMachine = GetComponentInParent <WashingMachine>(); Rotate(); }
public override bool Test(Sim a, WashingMachine target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { return(target.mWashState != WashingMachine.WashState.Running && target.mWashState != WashingMachine.WashState.RunningViolently && target.Repairable.Broken); }