Пример #1
0
        public void ValidateFailEmptyNameTest()
        {
            string name    = string.Empty;
            string command = "namesay";

            {
                CowFileInfo uut = new CowFileInfo();
                uut.CommandList[command] = name;
                Assert.Throws <ValidationException>(() => uut.Validate());
            }

            name = null;

            {
                CowFileInfo uut = new CowFileInfo();
                uut.CommandList[command] = name;
                Assert.Throws <ValidationException>(() => uut.Validate());
            }

            name = "     ";
            {
                CowFileInfo uut = new CowFileInfo();
                uut.CommandList[command] = name;
                Assert.Throws <ValidationException>(() => uut.Validate());
            }
        }
Пример #2
0
        public void ValidateSuccessTest()
        {
            string name    = "name";
            string command = "namesay";

            CowFileInfo uut = new CowFileInfo();

            uut.CommandList[command] = name;
            Assert.DoesNotThrow(() => uut.Validate());

            Assert.AreEqual(name, uut.CommandList[command]);
        }
Пример #3
0
        public void CloneTest()
        {
            string name    = "name";
            string command = "namesay";

            CowFileInfo uut1 = new CowFileInfo();

            uut1.CommandList[command] = name;
            CowFileInfo uut2 = uut1.Clone();

            Assert.AreNotSame(uut1, uut2);

            Assert.AreEqual(uut1.CommandList[command], uut2.CommandList[command]);
        }
Пример #4
0
        public void ValidateFailEmptyCommandTest()
        {
            string name    = "name";
            string command = string.Empty;

            {
                CowFileInfo uut = new CowFileInfo();
                uut.CommandList[command] = name;
                Assert.Throws <InvalidOperationException>(() => uut.Validate());
            }

            command = "     ";
            {
                CowFileInfo uut = new CowFileInfo();
                uut.CommandList[command] = name;
                Assert.Throws <InvalidOperationException>(() => uut.Validate());
            }
        }
Пример #5
0
        public void ValidateFailEmptyList()
        {
            CowFileInfo uut = new CowFileInfo();

            Assert.Throws <ValidationException>(() => uut.Validate());
        }