Example #1
0
        public void ThenIExpectTheFactoryToHaveTheFollowingResources(string factoryName, Table table)
        {
            var resourceComposition = _state.GetResourceComposition(table);

            var factoryQueryResult = _state.GetFactories();
            var factoryStates      = GetFactoryStates(factoryQueryResult);

            var factory = factoryStates.SingleOrDefault(i => i.Name == factoryName);

            Assert.IsNotNull(factory);

            var inventory = factory.Inventory;

            Assert.IsNotEmpty(inventory.Resources);

            foreach (var resource in resourceComposition.Keys)
            {
                List <IResource> collection = inventory.Resources.Keys.ToList();
                if (resourceComposition[resource] > 0)
                {
                    Assert.Contains(resource, collection);
                    Assert.AreEqual(resourceComposition[resource], inventory.Resources[resource]);
                }
                else
                {
                    // we know its 0
                    if (inventory.Resources.ContainsKey(resource))
                    {
                        Assert.AreEqual(resourceComposition[resource], inventory.Resources[resource]);
                    }
                }
            }
        }
        public void GivenIHaveCreatedTheFollowingMaterialCalled(string materialName, Table table)
        {
            var resourceComposition = _state.GetResourceComposition(table);

            var material = new Material(materialName, resourceComposition);

            _state.Materials.Add(material.Name, material);
        }