Exemplo n.º 1
0
        public void Parse_ValidArgs_Equality()
        {
            var size = VideoSize.Parse("1x2");

            Assert.AreEqual(1, size.Width);
            Assert.AreEqual(2, size.Height);
        }
Exemplo n.º 2
0
        public void Parse_InvalidArgs_Exceptions()
        {
            // VideoSize(string).
            Assert.Throws <ArgumentNullException>(() => VideoSize.Parse(null));
            Assert.Throws <ArgumentNullException>(() => VideoSize.Parse(""));
            Assert.Throws <FormatException>(() => VideoSize.Parse("x"));
            Assert.Throws <FormatException>(() => VideoSize.Parse("xx"));
            Assert.Throws <FormatException>(() => VideoSize.Parse("0x"));
            Assert.Throws <FormatException>(() => VideoSize.Parse("x0"));
            Assert.Throws <FormatException>(() => VideoSize.Parse("AxA"));
            Assert.Throws <FormatException>(() => VideoSize.Parse("1920x1080x36"));
            Assert.Throws <FormatException>(() => VideoSize.Parse("1231x-1231"));
            Assert.Throws <FormatException>(() => VideoSize.Parse("-1231x1231"));
            Assert.Throws <FormatException>(() => VideoSize.Parse("-1231x-1231"));

            // VideoSize(int, int).
            Assert.Throws <ArgumentOutOfRangeException>(() => new VideoSize(-1, 1));
            Assert.Throws <ArgumentOutOfRangeException>(() => new VideoSize(1, -1));
        }