public void TestGetTextureGroupForPoint() { var textureGroupResolver = new HeightmapPageTextureGroupResolver(_mockHeightmapPage, _mockTextureGroupRepository); var upperLeftTextureGroup = new TextureGroupRange(0, 50); var upperRightTextureGroup = new TextureGroupRange(51, 150); var lowerLeftTextureGroup = new TextureGroupRange(151, 200); var lowerRightTextureGroup = new TextureGroupRange(201, 255); _mockTextureGroupRepository.Add(upperLeftTextureGroup); _mockTextureGroupRepository.Add(upperRightTextureGroup); _mockTextureGroupRepository.Add(lowerLeftTextureGroup); _mockTextureGroupRepository.Add(lowerRightTextureGroup); var textureGroup = textureGroupResolver.GetTextureGroupForPoint(0, 0); Assert.AreSame(upperLeftTextureGroup, textureGroup); textureGroup = textureGroupResolver.GetTextureGroupForPoint(5, 0); Assert.AreSame(upperRightTextureGroup, textureGroup); textureGroup = textureGroupResolver.GetTextureGroupForPoint(0, 5); Assert.AreSame(lowerLeftTextureGroup, textureGroup); textureGroup = textureGroupResolver.GetTextureGroupForPoint(5, 5); Assert.AreSame(lowerRightTextureGroup, textureGroup); }
public void TestGetTextureGroupForPoint() { var textureGroupResolver = new HeightmapTextureGroupResolver(_mockHeightmap, _mockTextureGroupRepository); var upperLeftTextureGroup = new TextureGroupRange(0, 50); var upperRightTextureGroup = new TextureGroupRange(51, 150); var lowerLeftTextureGroup = new TextureGroupRange(151, 200); var lowerRightTextureGroup = new TextureGroupRange(201, 255); _mockTextureGroupRepository.Add(upperLeftTextureGroup); _mockTextureGroupRepository.Add(upperRightTextureGroup); _mockTextureGroupRepository.Add(lowerLeftTextureGroup); _mockTextureGroupRepository.Add(lowerRightTextureGroup); var textureGroup = textureGroupResolver.GetTextureGroupForPoint(0, 0); Assert.AreSame(upperLeftTextureGroup, textureGroup); textureGroup = textureGroupResolver.GetTextureGroupForPoint(5, 0); Assert.AreSame(upperRightTextureGroup, textureGroup); textureGroup = textureGroupResolver.GetTextureGroupForPoint(0, 5); Assert.AreSame(lowerLeftTextureGroup, textureGroup); textureGroup = textureGroupResolver.GetTextureGroupForPoint(5, 5); Assert.AreSame(lowerRightTextureGroup, textureGroup); }
public void TestCreate() { var textureGroupRange = new TextureGroupRange(0, 5); Assert.AreEqual(0, textureGroupRange.LowerBound); Assert.AreEqual(5, textureGroupRange.UpperBound); }
public void TestAddTextureGroup() { var textureGroupRangeRepository = new TextureGroupRangeRepository(); var textureGroupRange = new TextureGroupRange(0, 5); textureGroupRangeRepository.Add(textureGroupRange); Assert.IsTrue(textureGroupRangeRepository.Items.Contains(textureGroupRange)); }
public void TestTextureGroupAddedEvent() { var textureGroupRangeRepository = new TextureGroupRangeRepository(); var textureGroup = new TextureGroupRange(0, 5); var wasTextureGroupAdded = false; textureGroupRangeRepository.ItemAdded += addedTextureGroup => wasTextureGroupAdded = addedTextureGroup.Equals(textureGroup); textureGroupRangeRepository.Add(textureGroup); Assert.IsTrue(wasTextureGroupAdded); }
public void TestRemoveInvalidTextureGroup() { var textureGroupRangeRepository = new TextureGroupRangeRepository(); var textureGroupRange = new TextureGroupRange(0, 5); var invalidGroupRange = new TextureGroupRange(6, 10); textureGroupRangeRepository.Add(textureGroupRange); textureGroupRangeRepository.Remove(invalidGroupRange); Assert.IsTrue(textureGroupRangeRepository.Items.Contains(textureGroupRange)); Assert.IsFalse(textureGroupRangeRepository.Items.Contains(invalidGroupRange)); }
public void TestTextureGroupRemovedEventWithInvalidTextureGroup() { var textureGroupRangeRepository = new TextureGroupRangeRepository(); var textureGroup = new TextureGroupRange(0, 5); var invalidGroup = new TextureGroupRange(6, 10); var wasTextureGroupRemoved = false; textureGroupRangeRepository.ItemRemoved += removedTextureGroup => wasTextureGroupRemoved = removedTextureGroup.Equals(invalidGroup); textureGroupRangeRepository.Add(textureGroup); textureGroupRangeRepository.Remove(invalidGroup); Assert.IsFalse(wasTextureGroupRemoved); }
public void TestCreateWithIncorrectUpperBound() { var textureGroupRange = new TextureGroupRange(5, 0); }