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_Anno1404BothValuesZero_ShouldReturnFalse() { // Arrange var mockedDocument = new XmlDocument(); mockedDocument.LoadXml("<Info><BuildBlocker><Position><x>300</x><z>300</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, "variationFilename", Constants.ANNO_VERSION_1404); // Assert Assert.False(result); Assert.NotNull(mockedBuilding.Object.BuildBlocker); Assert.Empty(mockedBuilding.Object.BuildBlocker.Dict); }
public void GetBuildingBlocker_Anno1800ValueForzIsZero_ShouldSetzToOne() { // Arrange var mockedDocument = new XmlDocument(); mockedDocument.LoadXml("<Info><BuildBlocker><Position><xf>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.True(result); Assert.NotNull(mockedBuilding.Object.BuildBlocker); Assert.Equal(4, mockedBuilding.Object.BuildBlocker["x"]); Assert.Equal(1, 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 ctor_IfoProviderIsNull_ShouldThrow() { // Arrange/Act var ex = Assert.Throws <ArgumentNullException>(() => { var provider = new BuildingBlockProvider(null); }); // Assert Assert.NotNull(ex); }
public void GetBuildingBlocker_Anno1800BuildBlockerNotFound_ShouldReturnFalse(string ifodocument) { // Arrange var mockedDocument = new XmlDocument(); mockedDocument.LoadXml(ifodocument); 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.Null(mockedBuilding.Object.BuildBlocker); }