public void GetBuildingBlocker_Anno1800BuildingIsPalaceGate_ShouldSetCorrectSize()
        {
            // Arrange
            var mockedDocument = new XmlDocument();

            mockedDocument.LoadXml("<Info><BuildBlocker><Position><xf>2</xf><zf>2</zf></Position></BuildBlocker></Info>");

            var mockedIfoProvider = new Mock <IIfoFileProvider>();

            mockedIfoProvider.Setup(x => x.GetIfoFileContent(It.IsAny <string>(), It.IsAny <string>())).Returns(() => mockedDocument);

            var provider = new BuildingBlockProvider(mockedIfoProvider.Object);

            var mockedBuilding = new Mock <IBuildingInfo>();

            mockedBuilding.SetupAllProperties();
            mockedBuilding.SetupGet(x => x.Identifier).Returns("Palace_Module_05 (gate)");

            // Act
            var result = provider.GetBuildingBlocker("basePath", mockedBuilding.Object, "variationFilename", Constants.ANNO_VERSION_1800);

            // Assert
            Assert.True(result);
            Assert.NotNull(mockedBuilding.Object.BuildBlocker);
            Assert.Equal(3, mockedBuilding.Object.BuildBlocker["x"]);
            Assert.Equal(3, mockedBuilding.Object.BuildBlocker["z"]);
        }
        public void GetBuildingBlocker_Anno1404Bakery_ShouldReturnCorrectValue()
        {
            // Arrange
            var mockedDocument = new XmlDocument();

            mockedDocument.LoadXml(testData_Bakery);

            var mockedIfoProvider = new Mock <IIfoFileProvider>();

            mockedIfoProvider.Setup(x => x.GetIfoFileContent(It.IsAny <string>(), It.IsAny <string>())).Returns(() => mockedDocument);

            var provider = new BuildingBlockProvider(mockedIfoProvider.Object);

            var mockedBuilding = new Mock <IBuildingInfo>();

            mockedBuilding.SetupAllProperties();

            // Act
            var result = provider.GetBuildingBlocker("basePath", mockedBuilding.Object, "variationFilename", Constants.ANNO_VERSION_1404);

            // Assert
            Assert.True(result);
            Assert.NotNull(mockedBuilding.Object.BuildBlocker);
            Assert.Equal(3, mockedBuilding.Object.BuildBlocker["x"]);
            Assert.Equal(3, mockedBuilding.Object.BuildBlocker["z"]);
        }
        public void GetBuildingBlocker_Anno1800BothValuesZero_ShouldReturnFalse()
        {
            // Arrange
            var mockedDocument = new XmlDocument();

            mockedDocument.LoadXml("<Info><BuildBlocker><Position><xf>0.2</xf><zf>0.2</zf></Position></BuildBlocker></Info>");

            var mockedIfoProvider = new Mock <IIfoFileProvider>();

            mockedIfoProvider.Setup(x => x.GetIfoFileContent(It.IsAny <string>(), It.IsAny <string>())).Returns(() => mockedDocument);

            var provider = new BuildingBlockProvider(mockedIfoProvider.Object);

            var mockedBuilding = new Mock <IBuildingInfo>();

            mockedBuilding.SetupAllProperties();

            // Act
            var result = provider.GetBuildingBlocker("basePath", mockedBuilding.Object, "variationFilename", Constants.ANNO_VERSION_1800);

            // Assert
            Assert.False(result);
            Assert.NotNull(mockedBuilding.Object.BuildBlocker);
            Assert.Empty(mockedBuilding.Object.BuildBlocker.Dict);
        }
        public void GetBuildingBlocker_Anno1404VariationOrnamentalPost09_ShouldReturnCorrectValue()
        {
            // Arrange
            var mockedDocument = new XmlDocument();

            mockedDocument.LoadXml("<Info><BuildBlocker><Position><x>-8192</x><z>8192</z></Position></BuildBlocker></Info>");

            var mockedIfoProvider = new Mock <IIfoFileProvider>();

            mockedIfoProvider.Setup(x => x.GetIfoFileContent(It.IsAny <string>(), It.IsAny <string>())).Returns(() => mockedDocument);

            var provider = new BuildingBlockProvider(mockedIfoProvider.Object);

            var mockedBuilding = new Mock <IBuildingInfo>();

            mockedBuilding.SetupAllProperties();

            // Act
            var result = provider.GetBuildingBlocker("basePath", mockedBuilding.Object, "ornamental_post_09.txt", Constants.ANNO_VERSION_1404);

            // Assert
            Assert.True(result);
            Assert.NotNull(mockedBuilding.Object.BuildBlocker);
            Assert.Equal(7, mockedBuilding.Object.BuildBlocker["x"]);
            Assert.Equal(7, mockedBuilding.Object.BuildBlocker["z"]);
        }
        public void GetBuildingBlocker_Anno1404BuildBlockerHasNoChildNode_ShouldReturnFalse()
        {
            // Arrange
            var mockedDocument = new XmlDocument();

            mockedDocument.LoadXml("<Info><BuildBlocker></BuildBlocker></Info>");

            var mockedIfoProvider = new Mock <IIfoFileProvider>();

            mockedIfoProvider.Setup(x => x.GetIfoFileContent(It.IsAny <string>(), It.IsAny <string>())).Returns(() => mockedDocument);

            var provider = new BuildingBlockProvider(mockedIfoProvider.Object);

            var mockedBuilding = new Mock <IBuildingInfo>();

            mockedBuilding.SetupAllProperties();

            // Act
            var result = provider.GetBuildingBlocker("basePath", mockedBuilding.Object, "variationFilename", Constants.ANNO_VERSION_1404);

            // Assert
            Assert.False(result);
            Assert.Null(mockedBuilding.Object.BuildBlocker);
        }