Пример #1
0
        public void TestConstructorSetProperties()
        {
            const string name = "admin1";
            IPAddress address = IPAddress.Any;
            ITetriNETAdminCallback callback = new CountCallTetriNETAdminCallback();

            IAdmin admin = CreateAdmin(name, address, callback);

            Assert.AreEqual(admin.Name, name);
            Assert.AreEqual(admin.Address, address);
            Assert.AreEqual(admin.Callback, callback);
            Assert.AreNotEqual(admin.ConnectTime, default(DateTime));
            Assert.IsFalse(admin.Id.Equals(default(Guid)));
        }
Пример #2
0
        public void TestAddSameCallback()
        {
            IAdminManager adminManager = CreateAdminManager(10);
            ITetriNETAdminCallback callback = new CountCallTetriNETAdminCallback();
            adminManager.Add(CreateAdmin("admin1", callback));

            bool inserted = adminManager.Add(CreateAdmin("admin2", callback));

            Assert.IsFalse(inserted);
            Assert.AreEqual(1, adminManager.AdminCount);
            Assert.AreEqual(1, adminManager.Admins.Count());
        }