Ejemplo n.º 1
0
        /// <summary>
        /// Creates an uninitialized world
        /// Each realm provided will be initialized during the worlds initialization.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="gameDayToRealWorldHoursRatio">The game day to real world hours ratio.</param>
        /// <param name="hoursPerDay">The number of hours per day.</param>
        /// <param name="timePeriods">The time periods available to the world.</param>
        /// <param name="realms">The realms being added to the world.</param>
        /// <returns>Returns an IWorld instance</returns>
        public async Task<IWorld> CreateWorld(string name, double gameDayToRealWorldHoursRatio, int hoursPerDay, IEnumerable<ITimePeriod> timePeriods, IEnumerable<IRealm> realms)
        {
            var world = new MudWorld(this.realmFactory, timePeriods);

            world.SetName(name);
            world.GameDayToRealHourRatio = gameDayToRealWorldHoursRatio;
            world.SetHoursPerDay(hoursPerDay);

            if (realms.Count() > 0)
            {
                await world.AddRealmsToWorld(realms);
            }

            return world;
        }
Ejemplo n.º 2
0
        public async Task World_can_add_collection_of_realms()
        {
            // Arrange
            var world = new MudWorld(Mock.Of<IRealmFactory>());
            var realms = new List<IRealm>() { Mock.Of<IRealm>(r => r.Name == "R1"), Mock.Of<IRealm>(r => r.Name == "R2") };

            // Act
            await world.AddRealmsToWorld(realms);

            // Assert
            Assert.AreEqual(2, world.GetRealmsInWorld().Count());
        }