示例#1
0
        public void GlobalSetup()
        {
            const string filePath             = "particles_triangular_random.tsv";
            const string dataSeparator        = "\t";
            var          particlesCsvImporter = new ParticlesImporter();
            var          particles            = particlesCsvImporter.Import(filePath, dataSeparator);

            _particles = particles.Select(p => p as ICollidable).ToArray();
        }
示例#2
0
        public void CanImportParticlesFromFile()
        {
            // arrange
            const string filePath             = "Importers/particles_triangular_random.tsv";
            const string dataSeparator        = "\t";
            var          particlesCsvImporter = new ParticlesImporter();

            // act
            var particles = particlesCsvImporter.Import(filePath, dataSeparator);

            // assert
            particles.Length.Should().Be(175);
        }
示例#3
0
        public async Task Create_particles_triangular_random_benchmark_world_init_state()
        {
            var simulationId = "particles_triangular_random_init_state";

            DeleteSimulationSnapshotsFile(simulationId);

            const string filePath             = "Importers/particles_triangular_random.tsv";
            const string dataSeparator        = "\t";
            var          particlesCsvImporter = new ParticlesImporter();
            var          particles            = particlesCsvImporter.Import(filePath, dataSeparator);

            var rigidWalls = new[]
            {
                new RigidWall(new Vector2(-200, -200), new Vector2(250, -200)), //top
                new RigidWall(new Vector2(250, -200), new Vector2(200, 200)),   //right
                new RigidWall(new Vector2(200, 200), new Vector2(-200, 200)),   //bottom
                new RigidWall(new Vector2(-200, 200), new Vector2(-200, -200)), //left
            };
            var world = new World(particles, rigidWalls, 0);

            await _fileWorldStateSaver.SaveAsync(world, simulationId);
        }