Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MudWorld" /> class.
        /// </summary>
        /// <param name="realmFactory">The realm factory used to create new realms.</param>
        public MudWorld(IRealmFactory realmFactory)
        {
            this.HoursPerDay = 24;
            this.GameDayToRealHourRatio = 0.75;

            this.realmFactory = realmFactory;

            this.realms = new List<IRealm>();
            this.timePeriods = new List<ITimePeriod>();
            this.TimePeriodManager = new TimePeriodManager(Enumerable.Empty<ITimePeriod>());
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MudWorld" /> class.
        /// </summary>
        /// <param name="realmFactory">The realm factory used to create new realms.</param>
        public MudWorld(IRealmFactory realmFactory)
        {
            this.HoursPerDay            = 24;
            this.GameDayToRealHourRatio = 0.75;

            this.realmFactory = realmFactory;

            this.realms            = new List <IRealm>();
            this.timePeriods       = new List <ITimePeriod>();
            this.TimePeriodManager = new TimePeriodManager(Enumerable.Empty <ITimePeriod>());
        }
        public async Task World_can_create_a_realm()
        {
            // Arrange
            IRealmFactory factory = Mock.Of <IRealmFactory>(
                mock => mock.CreateRealm(It.IsAny <string>(), It.IsAny <IWorld>()) == Task.FromResult(Mock.Of <IRealm>()));

            var world     = new MudWorld(factory);
            var realmName = "Test Realm";

            // Act
            IRealm realm = await world.CreateRealm(realmName);

            // Assert
            Assert.IsNotNull(realm);
        }
        public async Task Adding_realm_to_world_without_a_name_throws_exception()
        {
            // Arrange
            IRealmFactory factory = Mock.Of <IRealmFactory>(
                mock => mock.CreateRealm(It.IsAny <string>(), It.IsAny <IWorld>()) == Task.FromResult(Mock.Of <IRealm>()));

            var    world     = new MudWorld(factory);
            var    realmName = "Test Realm";
            IRealm realm     = await world.CreateRealm(realmName);

            // Act
            await world.AddRealmToWorld(realm);

            // Assert
            Assert.Fail();
        }
        public async Task World_can_add_new_realm()
        {
            // Arrange
            IRealmFactory factory = Mock.Of <IRealmFactory>(
                mock => mock.CreateRealm(It.IsAny <string>(), It.IsAny <IWorld>()) == Task.FromResult(
                    Mock.Of <IRealm>(r => r.Name == "Unit Test")));

            var    world     = new MudWorld(factory);
            var    realmName = "Test Realm";
            IRealm realm     = await world.CreateRealm(realmName);

            // Act
            await world.AddRealmToWorld(realm);

            // Assert
            Assert.AreEqual(1, world.GetRealmsInWorld().Count());
        }
        public async Task Adding_realm_sets_its_enabled_flag()
        {
            // Arrange
            IRealmFactory factory = Mock.Of <IRealmFactory>(mock =>
                                                            mock.CreateRealm(It.IsAny <string>(), It.IsAny <IWorld>()) == Task.FromResult(
                                                                Mock.Of <IRealm>(r => r.Name == "Unit Test" && r.IsEnabled == true)));

            var    world     = new MudWorld(factory);
            var    realmName = "Test Realm";
            IRealm realm     = await world.CreateRealm(realmName);

            // Act
            await world.AddRealmToWorld(realm);

            // Assert
            Assert.IsTrue(realm.IsEnabled);
        }
Beispiel #7
0
 public RefreshRealmCommand(IRealmFactory realmFactory)
 {
     _realmFactory = realmFactory;
 }
Beispiel #8
0
 /// <summary>
 /// Creates a new instance of a Startup class, initializes it with the specified arguments.
 /// </summary>
 /// <param name="realmFactory"></param>
 /// <param name="syncFactory"></param>
 /// <param name="logger"></param>
 public Startup(IRealmFactory realmFactory, ISyncFactory syncFactory, ILogger <Startup> logger)
 {
     _realmFactory = realmFactory;
     _syncFactory  = syncFactory;
     _logger       = logger;
 }
Beispiel #9
0
 public GenerateGenresCommand(IRealmFactory realmFactory)
 {
     _realmFactory = realmFactory;
 }
Beispiel #10
0
 public UploadMovieImagesCommand(IRealmFactory realmFactory,
                                 IBlobService blobService)
 {
     _realmFactory = realmFactory;
     _blobService  = blobService;
 }
Beispiel #11
0
 public GenerateCategoriesCommand(IRealmFactory realmFactory)
 {
     _realmFactory = realmFactory;
 }
Beispiel #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MudWorldFactory"/> class.
 /// </summary>
 /// <param name="realmFactory">A realm factory that can be used for creating realms in the future.</param>
 public MudWorldFactory(IRealmFactory realmFactory)
 {
     this.realmFactory = realmFactory;
 }
Beispiel #13
0
 public GeneratePeopleCommand(IRealmFactory realmFactory)
 {
     _realmFactory = realmFactory;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MudWorldFactory"/> class.
 /// </summary>
 /// <param name="realmFactory">A realm factory that can be used for creating realms in the future.</param>
 public MudWorldFactory(IRealmFactory realmFactory)
 {
     this.realmFactory = realmFactory;
 }
Beispiel #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MudWorld"/> class.
 /// </summary>
 /// <param name="timePeriodsForWorld">The time periods for world.</param>
 public MudWorld(IRealmFactory realmFactory, IEnumerable<ITimePeriod> timePeriodsForWorld) : this(realmFactory)
 {
     this.timePeriods = new List<ITimePeriod>(timePeriodsForWorld);
     this.TimePeriodManager = new TimePeriodManager(timePeriodsForWorld);
 }
 public UploadMovieTrailersCommand(IRealmFactory realmFactory,
                                   IMediaService mediaService)
 {
     _realmFactory = realmFactory;
     _mediaService = mediaService;
 }
Beispiel #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MudWorld"/> class.
 /// </summary>
 /// <param name="timePeriodsForWorld">The time periods for world.</param>
 public MudWorld(IRealmFactory realmFactory, IEnumerable <ITimePeriod> timePeriodsForWorld) : this(realmFactory)
 {
     this.timePeriods       = new List <ITimePeriod>(timePeriodsForWorld);
     this.TimePeriodManager = new TimePeriodManager(timePeriodsForWorld);
 }
Beispiel #18
0
 public BuildBillboardCommand(IRealmFactory realmFactory)
 {
     _realmFactory = realmFactory;
 }