Thursday, 13 December 2018

Nunit installation in visual studio

1.open visual studio editor
2.click tools menu
3.select Nuget package Manager >package manager console
4. In console it will show PM>prompt
5.create your unit test project i,e library project where u going to write unit test case.
6.choose unit test project name from package manager console window
7.execute following commands one by one
PM>Install-Package Nunit -Version 3.8.1
PM>Install-Package Nunit3TestAdapter -Version 3.8.0
PM>Install-Package Nunit.ConsoleRunner -Version 3.8.0

Sample example program here:

using NUnit.Framework;
using Prime.Services;

namespace Prime.UnitTests.Services
{
    [TestFixture]
    public class PrimeService_IsPrimeShould
    {
        private readonly PrimeService _primeService;

        public PrimeService_IsPrimeShould()
        {
            _primeService = new PrimeService();
        }

        [Test]
        public void ReturnFalseGivenValueOf1()
        {
            var result = _primeService.IsPrime(1);

            Assert.IsFalse(result, "1 should not be prime");
        }
    }
}

Saturday, 28 July 2018

Regular Expression for validate Multiple Email




<!DOCTYPE html>
<html>
<body>


<form action="/action_page.php">
Email Id's(For multiple use';' Ex: arul@mail.com;arul2@mail.com) 
<input type="text" name="EmailId" 
pattern="^((\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)\s*[;]{0,1}\s*)+$" 
required title="Email id's">
<input type="submit">
</form>


<p><strong>Note:</strong> The pattern attribute of the input tag is not supported in Internet Explorer 9 and earlier versions
or Safari 10 and earlier.</p>


</body>
</html>