Exemplo n.º 1
0
        public virtual void SetUp()
        {
            var configurationBuilder = new Autofac.ContainerBuilder();

            var fresh = new CreateFreshDatabase();
            fresh.Create(configurationBuilder);

            var resolver = new AutofacResolver(configurationBuilder);

            Database = resolver.Resolve<IDocumentStore>();
            Universe = new MockUniverse();
        }
Exemplo n.º 2
0
        public void Update()
        {
            var world = new MockUniverse();
            var universe = Universe.Builder.Build(world.Universe).Materialise();

            var sol = universe.StarClusters
                .SelectMany(x => x.SolarSystems)
                .Single(x => x.Id == world.SolarSystem.ObjectId);

            var earth = sol.Satellites
                .Single(x => x.Id == world.Earth.ObjectId);

            var game = new Game(universe, u => Orbit(Satellites(u)));

            var ticksRemaining = game.Update();
            ticksRemaining.ShouldBeGreaterThan(0);

            earth.Position.LocalCoordinates.ShouldNotBe(world.Earth.LocalCoordinates);
        }
Exemplo n.º 3
0
        public void GetSolarSystem()
        {
            var s = new MockUniverse();
            Assert.That(s.Universe.StarClusters, Is.Not.Empty);

            var builder = Universe.Builder.Build(s.Universe);
            builder.Add(Corporation.Builder.Build(s.MSCorp));

            var u = builder.Materialise();

            u.StarClusters.ShouldNotBeEmpty();
            u.SolarSystems().ShouldNotBeEmpty();

            var sol = u.SolarSystems().Single(x => x.Id == s.SolarSystem.ObjectId);
            var earth = u.Planets().Single(p => p.Id == s.Earth.ObjectId);

            earth.Position.GetSolarSystem().ShouldBe(sol);

            var ship = new Ship {Position = new Position(earth, new Vector(1, 1))};
            ship.Position.GetSolarSystem().ShouldBe(sol);
        }
Exemplo n.º 4
0
        public void EarthOrbit()
        {
            var world = new MockUniverse();
            var universe = Universe.Builder.Build(world.Universe).Materialise();

            var sol = universe.StarClusters
                .SelectMany(x => x.SolarSystems)
                .Single(x => x.Id == world.SolarSystem.ObjectId);

            var earth = sol.Satellites
                .Single(x => x.Id == world.Earth.ObjectId);

            var context = new TickContext(0) { ElapsedTicks = 60 * 60 * 5 };
            var orbiter = new Orbiter(sol);
            var orbitRadius = earth.Position.LocalCoordinates.Magnitude;

            for (var i = 0; i < 12*21; i++)
            {
                orbiter.Orbit(context);
                Console.WriteLine("{0}: {1:n}", i, earth.Position.LocalCoordinates * 1e-5);

                earth.Position.LocalCoordinates.Magnitude.ShouldBe(orbitRadius, Units.Tolerance*100);
            }
        }
Exemplo n.º 5
0
        public void CreateItemFactory()
        {
            _universe = new MockUniverse();

            _itemFactory = new Moq.Mock<IItemFactory>(MockBehavior.Strict);

            SetupItem(_universe.BluePrint);
            SetupItem(_universe.ShipBluePrint);

            var builder = Echo.Structures.Manufactory.Builder.For(_universe.Manufactory).Build(null);
            builder.Add(Corporation.Builder.Build(_universe.MSCorp));

            _manufactory = builder.Materialise();
        }
Exemplo n.º 6
0
        public void SetUp()
        {
            _universe = new MockUniverse();

            var mock = new Moq.Mock<ILocationServices>();
            mock.Setup(x => x.GetExitPosition(It.IsAny<ILocation>())).Returns<ILocation>(l => l.Position.LocalCoordinates);

            _task = new UndockShipTask(mock.Object);
        }