/// <summary> /// Gets all shops and recycling machines /// </summary> private void GetMachines(int imgNumber) { var task = Facade.Connector.GetAction("Machine"); var result = task.Result; var array = JArray.Parse(result); Machine machine; foreach (var item in array) { if (item["machineType"].Value <int>() == 0) { machine = new RecyclingMachine( item["posX"].Value <int>(), item["posY"].Value <int>(), item["sizeX"].Value <int>(), item["sizeY"].Value <int>(), imgNumber ); Machines.Add(machine); } else { machine = new Shop( item["posX"].Value <int>(), item["posY"].Value <int>(), item["sizeX"].Value <int>(), item["sizeY"].Value <int>(), imgNumber ); Machines.Add(machine); } Controls.Add(machine.Image); } }
public void Clone_ClonesObject_returnsShallowCopy() { //Arrange var recyclingMachine = new RecyclingMachine(0, 0, 16, 16, 1); //Act var recyclingMachineClone = recyclingMachine.Clone(); //Assert Assert.ReferenceEquals(recyclingMachine, recyclingMachineClone); }
public void RecyclingMachine_CreatingWithCoordinates_RecyclingMachineIsCreatedAt00Size1616() { //Arrange RecyclingMachine recyclingMachine; //Act recyclingMachine = new RecyclingMachine(0, 0, 16, 16, 1); //Assert Assert.AreEqual(recyclingMachine.PositionX, 0); Assert.AreEqual(recyclingMachine.PositionY, 0); Assert.AreEqual(recyclingMachine.SizeX, 16); Assert.AreEqual(recyclingMachine.SizeY, 16); }
public void PopulateListAsRecyclingMachines(Collection <Point> locations, int imageId)//int IMG (1 = first img; 2 = second img) { if (locations == null) { throw new ArgumentNullException("locations", "locations is NULL"); } Machine recyclingMachine = new RecyclingMachine(0, 0, 16, 16, imageId); foreach (var item in locations) { Machines.Add(recyclingMachine.Clone()); Machines.Last().PositionX = item.X; Machines.Last().PositionY = item.Y; } }