public void WillUseMaxUsageValueWhenCreatingBrickMap() { var input_list = new List <MapSquare>() { new MapSquare() { Type = SquareTypes.Land, PositionX = 0, PositionZ = 0 }, new MapSquare() { Type = SquareTypes.Land, PositionX = 0, PositionZ = 1 }, new MapSquare() { Type = SquareTypes.Land, PositionX = 1, PositionZ = 0 }, new MapSquare() { Type = SquareTypes.Land, PositionX = 1, PositionZ = 1 }, }; var brick_repo = new BrickRepo(TestHelper.AssemblyDirectory + "BrickRepoTests_BrickList01.xlsx"); var s2b = new SquaresToBrickMaps(brick_repo); var result = s2b.ParseList(2, 2, 10, 10, input_list); Assert.That(result.Count, Is.EqualTo(3)); Assert.That(result.Count(x => x.ToXml().Contains("3023")), Is.EqualTo(1)); Assert.That(result.Count(x => x.ToXml().Contains("3024")), Is.EqualTo(2)); }
public void WillUseColorWhenCheckingIfBrickMaxUsageHasBeenReached() { var repo = new BrickRepo(TestHelper.AssemblyDirectory + "BrickRepoTests_BrickList01.xlsx"); var size = new DesignItem() { DesignID = 3023, Transform = "" }; var non_existing_color = 4444; Assert.That(repo.IfBrickMaxUsageHasBeenReached(non_existing_color, size.DesignID), Is.True); }
public void CanGetSizes() { var repo = new BrickRepo(TestHelper.AssemblyDirectory + "BrickRepoTests_BrickList01.xlsx"); var sizes = repo.GetBrickSizesForMaterialId(28); Assert.That(sizes.Count, Is.EqualTo(6)); Assert.That(sizes.Count(a => a.SizeX == 1 && a.SizeZ == 1), Is.EqualTo(1)); Assert.That(sizes.Count(a => a.SizeX == 2 && a.SizeZ == 1), Is.EqualTo(1)); Assert.That(sizes.Count(a => a.SizeX == 1 && a.SizeZ == 2), Is.EqualTo(1)); Assert.That(sizes.Count(a => a.SizeX == 4 && a.SizeZ == 4), Is.EqualTo(1)); Assert.That(sizes.Count(a => a.SizeX == 4 && a.SizeZ == 10), Is.EqualTo(1)); Assert.That(sizes.Count(a => a.SizeX == 10 && a.SizeZ == 4), Is.EqualTo(1)); }
public void CanCheckIfBrickMaxUsageHasBeenReached() { var repo = new BrickRepo(TestHelper.AssemblyDirectory + "BrickRepoTests_BrickList01.xlsx"); var size = new DesignItem() { DesignID = 3023, Transform = "" }; Assert.That(repo.IfBrickMaxUsageHasBeenReached(28, size.DesignID), Is.False); repo.GetBrick(size, 28, 399, 0, 0); Assert.That(repo.IfBrickMaxUsageHasBeenReached(28, size.DesignID), Is.True); }
public void CanGetBrick() { var repo = new BrickRepo(TestHelper.AssemblyDirectory + "BrickRepoTests_BrickList01.xlsx"); var size = new DesignItem() { DesignID = 3030, SizeX = 10, SizeZ = 4, OffsetX = 0.4f, OffsetZ = 2.8f, Transform = "1,0,0,0,1,0,0,0,1,{0},0,{1}" }; var brick = repo.GetBrick(size, 28, 399, 0, 0); Assert.That(brick.ToXml(), Is.EqualTo("<Brick refID=\"399\" designID=\"3030\"><Part refID=\"399\" designID=\"3030\" materials=\"28\"><Bone refID=\"399\" transformation=\"1,0,0,0,1,0,0,0,1,0.4,0,2.8\"></Bone></Part></Brick>")); }
public void CanGetSizesInRightOrder() { var repo = new BrickRepo(TestHelper.AssemblyDirectory + "BrickRepoTests_BrickList01.xlsx"); var sizes = repo.GetBrickSizesForMaterialId(28); Assert.That(sizes.Count, Is.EqualTo(6)); Assert.That(sizes[0].SizeX, Is.EqualTo(10)); Assert.That(sizes[0].SizeZ, Is.EqualTo(4)); Assert.That(sizes[1].SizeX, Is.EqualTo(4)); Assert.That(sizes[1].SizeZ, Is.EqualTo(10)); Assert.That(sizes[2].SizeX, Is.EqualTo(4)); Assert.That(sizes[2].SizeZ, Is.EqualTo(4)); Assert.That(sizes[3].SizeX, Is.EqualTo(2)); Assert.That(sizes[3].SizeZ, Is.EqualTo(1)); Assert.That(sizes[4].SizeX, Is.EqualTo(1)); Assert.That(sizes[4].SizeZ, Is.EqualTo(2)); Assert.That(sizes[5].SizeX, Is.EqualTo(1)); Assert.That(sizes[5].SizeZ, Is.EqualTo(1)); }