Пример #1
0
        public void GetValidationErrorTitleTest()
        {
            var props = new MxConsoleProperties();

            props.Title = null;
            Assert.Equal($"Title is null", props.GetValidationError());
        }
Пример #2
0
        public void GetValidationErrorCursorLeftTest()
        {
            var props = new MxConsoleProperties();

            props.CursorLeft = -1;
            Assert.Equal($"CursorLeft={props.CursorLeft} is out of range (BufferWidth={MxConsoleProperties.DefaultBufferWidth})", props.GetValidationError());
            props.CursorLeft = props.BufferWidth;
            Assert.Equal($"CursorLeft={props.CursorLeft} is out of range (BufferWidth={MxConsoleProperties.DefaultBufferWidth})", props.GetValidationError());
        }
Пример #3
0
        public void GetValidationErrorCursorTopTest()
        {
            var props = new MxConsoleProperties();

            props.CursorTop = -1;
            Assert.Equal($"CursorTop={props.CursorTop} is out of range (BufferHeight={MxConsoleProperties.DefaultBufferHeight})", props.GetValidationError());
            props.CursorTop = props.BufferHeight;
            Assert.Equal($"CursorTop={props.CursorTop} is out of range (BufferHeight={MxConsoleProperties.DefaultBufferHeight})", props.GetValidationError());
        }
Пример #4
0
        public void GetValidationErrorCursorSizeTest()
        {
            var props = new MxConsoleProperties();

            props.CursorSize = 0;
            Assert.Equal($"CursorSize={props.CursorSize} is out of range 1-100", props.GetValidationError());
            props.CursorSize = 101;
            Assert.Equal($"CursorSize={props.CursorSize} is out of range 1-100", props.GetValidationError());
        }
Пример #5
0
        public void GetValidationErrorBufferWidthTest()
        {
            var props = new MxConsoleProperties();

            props.BufferWidth = -1;
            Assert.Equal($"BufferWidth={ props.BufferWidth} is out of range (WindowLeft={MxConsoleProperties.DefaultWindowLeft}, WindowWidth={MxConsoleProperties.DefaultWindowWidth})", props.GetValidationError());
            props.BufferWidth = Int16.MaxValue;
            Assert.Equal($"BufferWidth={ props.BufferWidth} is out of range (WindowLeft={MxConsoleProperties.DefaultWindowLeft}, WindowWidth={MxConsoleProperties.DefaultWindowWidth})", props.GetValidationError());
            props.BufferWidth = props.WindowLeft + props.WindowWidth - 1;
            Assert.Equal($"BufferWidth={ props.BufferWidth} is out of range (WindowLeft={MxConsoleProperties.DefaultWindowLeft}, WindowWidth={MxConsoleProperties.DefaultWindowWidth})", props.GetValidationError());
        }
Пример #6
0
        public void GetValidationErrorBufferHeightTest()
        {
            var props = new MxConsoleProperties();

            props.BufferHeight = -1;
            Assert.Equal($"BufferHeight={props.BufferHeight} is out of range (WindowTop={MxConsoleProperties.DefaultWindowTop}, WindowHeight={MxConsoleProperties.DefaultWindowHeight})", props.GetValidationError());
            props.BufferHeight = Int16.MaxValue;
            Assert.Equal($"BufferHeight={props.BufferHeight} is out of range (WindowTop={MxConsoleProperties.DefaultWindowTop}, WindowHeight={MxConsoleProperties.DefaultWindowHeight})", props.GetValidationError());
            props.BufferHeight = props.WindowTop + props.WindowHeight - 1;
            Assert.Equal($"BufferHeight={props.BufferHeight} is out of range (WindowTop={MxConsoleProperties.DefaultWindowTop}, WindowHeight={MxConsoleProperties.DefaultWindowHeight})", props.GetValidationError());
        }
Пример #7
0
        public void GetValidationErrorWindowWidthTest()
        {
            var props = new MxConsoleProperties();

            props.WindowWidth = -1;
            Assert.Equal($"WindowWidth={props.WindowWidth} is out of range (WindowLeft={MxConsoleProperties.DefaultWindowLeft})", props.GetValidationError());
            //caught by BufferWidth test
            //props.WindowWidth = Int16.MaxValue;
            //Assert.Equal($"error WindowWidth={props.WindowWidth} is out of range (WindowLeft={MxConsoleProperties.DefaultWindowLeft})", props.GetValidationError());
            //props.WindowWidth = Console.LargestWindowWidth;
            //Assert.Equal($"error WindowWidth={props.WindowWidth} is out of range (WindowLeft={MxConsoleProperties.DefaultWindowLeft})", props.GetValidationError());
        }
Пример #8
0
        public void GetValidationErrorWindowHeightTest()
        {
            var props = new MxConsoleProperties();

            props.WindowHeight = -1;
            Assert.Equal($"WindowHeight={props.WindowHeight} is out of range (WindowTop={MxConsoleProperties.DefaultWindowTop})", props.GetValidationError());
            //caught by BufferHeight test
            //props.WindowHeight = Int16.MaxValue;
            //Assert.Equal($"error WindowHeight={props.WindowHeight} is out of range (WindowTop={MxConsoleProperties.DefaultWindowTop})", props.GetValidationError());
            //props.WindowHeight = Console.LargestWindowHeight + 1;
            //Assert.Equal($"error WindowHeight={props.WindowHeight} is out of range (WindowTop={MxConsoleProperties.DefaultWindowTop})", props.GetValidationError());
        }
Пример #9
0
        public void GetValidationErrorWindowTopTest()
        {
            var props = new MxConsoleProperties();

            props.WindowTop = -1;
            Assert.Equal($"WindowTop={props.WindowTop} is less than zero", props.GetValidationError());
            props.WindowHeight = 50;
            props.BufferHeight = props.WindowHeight;
            props.WindowTop    = 0; //ok to display line 50 of buffer in bottom line of window
            Assert.Null(props.GetValidationError());
            props.WindowTop = 1;    //attempting to display line 51 of buffer in bottom line of window - it doesn't exist!
            Assert.StartsWith($"BufferHeight={props.BufferHeight} is out of range (WindowTop={props.WindowTop}, WindowHeight={props.WindowHeight})", props.GetValidationError());
        }
Пример #10
0
        public void GetValidationErrorWindowLeftTest()
        {
            var props = new MxConsoleProperties();

            props.WindowLeft = -1;
            Assert.Equal($"WindowLeft={props.WindowLeft} is less than zero", props.GetValidationError());

            props.WindowWidth = 120;
            props.BufferWidth = props.WindowWidth;
            props.WindowLeft  = 0; //ok to display column 120 of buffer in RHS of window
            Assert.Null(props.GetValidationError());
            props.WindowLeft = 1;  //attempting to display column 121 of buffer in right most column of window - it doesn't exist!
            Assert.Equal($"BufferWidth={props.BufferWidth} is out of range (WindowLeft={props.WindowLeft}, WindowWidth={props.WindowWidth})", props.GetValidationError());
        }
Пример #11
0
        public void GetValidationErrorTest()
        {
            var props = new MxConsoleProperties();

            Assert.Null(props.GetValidationError());
        }
Пример #12
0
        public void ValidateDefaultTest()
        {
            var props = new MxConsoleProperties();

            Assert.True(props.Validate());
        }
Пример #13
0
        public void NoParamTest()
        {
            var props = new MxConsoleProperties();

            Assert.False(props.IsError());
        }