コード例 #1
0
        public void ThrowException_WhenDecimalFromStringMethod_IsProvidedInvalidDecimalNumber()
        {
            //Arrange
            var fakeWriter    = new Mock <IWriter>();
            var mockValidator = new ValidateCore(fakeWriter.Object);

            //Act & Assert
            Assert.ThrowsException <ArgumentException>(() => mockValidator.DecimalFromString("7362837631885984375874353457463284", "parameter"));
        }
コード例 #2
0
        public void ThrowException_WhenStringForNullEmptyMethod_IsProvidedNullValue()
        {
            //Arrange
            var fakeWriter    = new Mock <IWriter>();
            var mockValidator = new ValidateCore(fakeWriter.Object);

            //Act & Assert
            Assert.ThrowsException <ArgumentException>(() => mockValidator.StringForNullEmpty(null));
        }
コード例 #3
0
        public void ThrowException_WhenIntFromStringMethod_IsProvidedString()
        {
            //Arrange
            var fakeWriter    = new Mock <IWriter>();
            var mockValidator = new ValidateCore(fakeWriter.Object);

            //Act & Assert
            Assert.ThrowsException <ArgumentException>(() => mockValidator.IntFromString("alabala", "parameter"));
        }
コード例 #4
0
        public void ParsesCorrectValue_WhenDecimalFromStringMethod_IsProvidedValidDecimalNumber()
        {
            //Arrange
            var     fakeWriter     = new Mock <IWriter>();
            var     mockValidator  = new ValidateCore(fakeWriter.Object);
            decimal expectedNumber = 73811430193474;

            //Act & Assert
            Assert.AreEqual(expectedNumber, mockValidator.DecimalFromString("73811430193474", "parameter"));
        }
コード例 #5
0
        public void ParsesCorrectValue_WhenIntFromStringMethod_IsProvidedValidIntegerNumber()
        {
            //Arrange
            var fakeWriter     = new Mock <IWriter>();
            var mockValidator  = new ValidateCore(fakeWriter.Object);
            int expectedNumber = 7384;

            //Act & Assert
            Assert.AreEqual(expectedNumber, mockValidator.IntFromString(expectedNumber.ToString(), "parameter"));
        }
コード例 #6
0
        public void ThrowException_WhenCheckNullObjectMethod_IsProvidedStringOfNullValues()
        {
            //Arrange
            var fakeWriter        = new Mock <IWriter>();
            var mockValidator     = new ValidateCore(fakeWriter.Object);
            var listWithNullValue = new object[] { "test", null };

            //Act & Assert
            Assert.ThrowsException <ArgumentException>(() => mockValidator.CheckNullObject(listWithNullValue));
        }
コード例 #7
0
        public void ThrowException_WhenStringForNullEmptyMethod_IsProvidedStringOfEmptyValue()
        {
            //Arrange
            var fakeWriter         = new Mock <IWriter>();
            var mockValidator      = new ValidateCore(fakeWriter.Object);
            var listWithEmptyValue = new string[] { "", "test" };

            //Act & Assert
            Assert.ThrowsException <ArgumentException>(() => mockValidator.StringForNullEmpty(listWithEmptyValue));
        }