public void ShouldEndTaskWhenStackExists() { HarvesterModule module; IBuildingModule buildingModule; IBuildingTypeModule buildingTypeModule; IWorkerModule workerModule; IStackModule stackModule; IProductModule productModule; ITaskModule taskModule; MockedSchedulerModule schedulerModule; Stack stack; buildingModule = new MockedBuildingModule(false, new Building() { BuildingID = 1, BuildingTypeID = BuildingTypeIDs.Sawmill }); buildingTypeModule = new MockedBuildingTypeModule(false, new BuildingType() { BuildingTypeID = BuildingTypeIDs.Sawmill, IsFarm = true }); workerModule = new MockedWorkerModule(false, new Worker() { WorkerID = 1, PlanetID = 1 }); stackModule = new MockedStackModule(false, new Stack() { StackID = 0, BuildingID = 1, ResourceTypeID = ResourceTypeIDs.Plank, Quantity = 10 }, new Stack() { StackID = 1, BuildingID = 1, ResourceTypeID = ResourceTypeIDs.Wood, Quantity = 10 }, new Stack() { StackID = 2, BuildingID = 1, ResourceTypeID = ResourceTypeIDs.Stone, Quantity = 10 }, new Stack() { StackID = 3, BuildingID = 1, ResourceTypeID = ResourceTypeIDs.Coal, Quantity = 10 } ); productModule = new MockedProductModule(false, new Product() { ProductID = 1, ResourceTypeID = ResourceTypeIDs.Stone, BuildingTypeID = BuildingTypeIDs.Sawmill, Duration = 4, Quantity = 2 }); taskModule = new MockedTaskModule(false); module = new HarvesterModule(NullLogger.Instance, taskModule, workerModule, buildingModule, buildingTypeModule, stackModule, productModule); schedulerModule = new MockedSchedulerModule(false, module); module.EndHarvest(1); stack = stackModule.GetStack(2); Assert.AreEqual(12, stack.Quantity); }
public void ShouldEndTaskWhenStackExists() { StorerModule module; IBuildingModule buildingModule; IWorkerModule workerModule; IStackModule stackModule; ITaskModule taskModule; MockedSchedulerModule schedulerModule; Stack stack; buildingModule = new MockedBuildingModule(false, new Building() { BuildingID = 2, X = 10, Y = 10 }); workerModule = new MockedWorkerModule(false, new Worker() { WorkerID = 1, PlanetID = 1, X = 10, Y = 10, ResourceTypeID = ResourceTypeIDs.Stone }); stackModule = new MockedStackModule(false, new Stack() { StackID = 0, BuildingID = 2, ResourceTypeID = ResourceTypeIDs.Plank, Quantity = 10 }, new Stack() { StackID = 1, BuildingID = 2, ResourceTypeID = ResourceTypeIDs.Wood, Quantity = 10 }, new Stack() { StackID = 2, BuildingID = 2, ResourceTypeID = ResourceTypeIDs.Stone, Quantity = 10 }, new Stack() { StackID = 3, BuildingID = 2, ResourceTypeID = ResourceTypeIDs.Coal, Quantity = 10 } ); taskModule = new MockedTaskModule(false); module = new StorerModule(NullLogger.Instance, taskModule, workerModule, buildingModule, stackModule); schedulerModule = new MockedSchedulerModule(false, module); module.EndStore(1, ResourceTypeIDs.Stone); stack = stackModule.GetStack(2); Assert.AreEqual(11, stack.Quantity); //Assert.AreEqual(2, workerModule.GetWorker(1).FactoryID); }