Esempio n. 1
0
        public async Task World_does_not_add_same_realm_twice()
        {
            // 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);
            await world.AddRealmToWorld(realm);

            // Assert
            Assert.AreEqual(1, world.GetRealmsInWorld().Count());
        }
Esempio 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());
        }