예제 #1
0
        public void ClientKeyIdCreation()
        {
            string id        = "ER$%^667";
            string name      = "TestClt";
            string appPath   = "TestClt\\qewqew \\qwerq\\qwer";
            string logPath   = "TestClt\\245\\vfd erw5\\wregerw";
            int    timeout   = 345;
            int    port      = 0;
            bool   mail      = false;
            bool   logAttach = true;
            int    queueSize = 56;

            ClientDataManager cdm = new ClientDataManager();

            Assert.IsFalse(cdm.ContainsId(id));
            Assert.IsFalse(cdm.ContainsName(name));

            ClientData clt = cdm.CreateClient(ClientIdType.KeyByIdString,
                                              id,
                                              port,
                                              name,
                                              appPath,
                                              logPath,
                                              timeout,
                                              mail,
                                              logAttach,
                                              queueSize);

            Assert.IsTrue(cdm.ContainsId(id));
            Assert.IsFalse(cdm.ContainsPort(port));
            Assert.IsTrue(cdm.ContainsName(name));
            Assert.AreEqual(id, clt.Id);
            Assert.AreEqual(name, clt.Name);
            Assert.AreEqual(appPath, clt.AppFilePath);
            Assert.AreEqual(logPath, clt.LogFilePath);
            Assert.AreEqual(timeout, clt.Timeout);
            Assert.AreEqual(mail, clt.MailEnabled);
            Assert.AreEqual(logAttach, clt.LogAttachEnabled);
            Assert.AreEqual(queueSize, clt.QueueSize);

            ClientData newclt = cdm.GetClient(id);

            Assert.AreEqual(clt, newclt);

            Assert.AreEqual(1, cdm.List.Length);
            cdm.Delete(newclt.ClientId);
            Assert.AreEqual(0, cdm.List.Length);
        }