public void IsSplatmapStored() { var heightmap = new HeightmapDto(); var splatmap = new SplatmapDto(); var mockHeightmapGenerator = new Mock <IDiamondSquareGenerator>(); mockHeightmapGenerator.Setup(x => x.Generate( It.IsAny <int>(), It.IsAny <float>(), It.IsAny <float>(), It.IsAny <int?>() )).Returns(heightmap); var mockSplatmapGenerator = new Mock <IHeightBasedSplatmapGenerator>(); mockSplatmapGenerator.Setup(x => x.Generate( It.IsAny <float[, ]>(), It.IsAny <float>(), It.IsAny <float>(), It.IsAny <float>() )).Returns(splatmap); var mockRepository = new Mock <IRepository>(); var terrainService = new TerrainService(mockRepository.Object, mockSplatmapGenerator.Object, null, mockHeightmapGenerator.Object, null); var id = terrainService.Generate(new DiamondSquareHeightmapRequestDto { Size = 17, OffsetRange = 10, OffsetReductionRate = 0.5f }); mockRepository.Verify(mock => mock.AddSplatmap(splatmap), Times.Once()); }
public void AddSplatmap(SplatmapDto splatmapDto) { var splatmap = new Splatmap { Id = splatmapDto.Id, SplatmapByteArray = splatmapDto.SplatmapByteArray }; splatmaps.Add(splatmapDto.Id, splatmap); }