public void IsPositive_Int_WhenPositive_DoesNothing()
        {
            //Arrange
            int argument = 1;

            //Act
            AssertArgument.IsPositive(nameof(argument), argument);
        }
        public void IsPositive_Float_WhenPositive_DoesNothing()
        {
            //Arrange
            float argument = 1f;

            //Act
            AssertArgument.IsPositive(nameof(argument), argument);
        }
Esempio n. 3
0
        public Resolution(float widthInches, float heightInches, int dpi)
        {
            AssertArgument.IsPositive(nameof(widthInches), widthInches);
            AssertArgument.IsPositive(nameof(heightInches), heightInches);
            AssertArgument.IsPositive(nameof(dpi), dpi);

            Width  = widthInches;
            Height = heightInches;
            DPI    = dpi;
        }
Esempio n. 4
0
        public ImageSize(int pixelWidth, int pixelHeight, int dpi)
        {
            AssertArgument.IsPositive(nameof(pixelWidth), pixelWidth);
            AssertArgument.IsPositive(nameof(pixelHeight), pixelHeight);
            AssertArgument.IsPositive(nameof(dpi), dpi);

            PixelWidth  = pixelWidth;
            PixelHeight = pixelHeight;
            DPI         = dpi;
            Width       = ToInches(PixelWidth, DPI);
            Height      = ToInches(pixelHeight, dpi);
        }
Esempio n. 5
0
        public ImageSize(float width, float height, int dpi)
        {
            AssertArgument.IsPositive(nameof(width), width);
            AssertArgument.IsPositive(nameof(height), height);
            AssertArgument.IsPositive(nameof(dpi), dpi);

            Width       = width;
            Height      = height;
            DPI         = dpi;
            PixelHeight = ToPixels(height, dpi);
            PixelWidth  = ToPixels(width, dpi);
        }
        public void IsPositive_Int_WhenZero_ThrowsException()
        {
            //Arrange
            int    argument        = 0;
            string argumentName    = "0AA69E84-F022-4B6A-AE13-4B69719E4C89";
            string expectedMessage = GetArgumentMustBePositiveExceptionMessage(argumentName);

            try
            {
                //Act
                AssertArgument.IsPositive(argumentName, argument);
            }
            catch (Exception ex)
            {
                //Assert
                Assert.IsInstanceOfType(ex, typeof(ArgumentException));
                Assert.AreEqual(expectedMessage, ex.Message);
                return;
            }

            FailOnNoException();
        }