private IResourceDefinition BuildResource(ResourceTestData data)
        {
            var mockResource = new Mock <IResourceDefinition>();

            mockResource.Setup(resource => resource.Type).Returns(data.Type);

            return(mockResource.Object);
        }
Esempio n. 2
0
        private IResourceDefinition BuildResourceDefinition(
            ResourceTestData data, List <IImprovementTemplate> availableTemplates
            )
        {
            var mockResource = new Mock <IResourceDefinition>();

            mockResource.Setup(resource => resource.Type).Returns(data.Type);

            mockResource.Setup(resource => resource.Extractor).Returns(
                data.ExtractorIndex >= 0 ? availableTemplates[data.ExtractorIndex] : null
                );

            var newResource = mockResource.Object;

            MockTechCanon.Setup(canon => canon.IsResourceDiscoveredByCiv(newResource, It.IsAny <ICivilization>()))
            .Returns(data.IsVisibleToCiv);

            return(newResource);
        }