using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AddressBookBal;
using AddressBookDal;
using NUnit.Framework;
namespace TestAddressBook
{
[TestFixture]
class TestUserInformation
{
[TestCase]
public void TestAddNewUser()
{
UserInformationBal userbal=new UserInformationBal();
UserInformationDal userInformationDal=new UserInformationDal();
userInformationDal.Title = "Mr";
userInformationDal.FirstName="Ajay";
userInformationDal.MiddleName = "ramesh";
userInformationDal.LastName = "Sonkul";
userInformationDal.Age = 30;
userInformationDal.DateOfBirth = DateTime.Now;
userInformationDal.Sex = "Male";
userInformationDal.Category = "Family";
String UserId = userbal.AddUserInformation(userInformationDal);
UserInformationDal user = userbal.GetUserInfoById(UserId);
if (user.Title == userInformationDal.Title && user.FirstName == userInformationDal.FirstName && user.MiddleName == userInformationDal.MiddleName && user.LastName == userInformationDal.LastName && user.Age == userInformationDal.Age && user.DateOfBirth == userInformationDal.DateOfBirth && user.Sex == userInformationDal.Sex && user.Category == userInformationDal.Category)
{
Assert.IsTrue(true);
}
else
{
// userbal.GetUserInfoById(UserId);
Assert.IsTrue(false);
}
}
[TestCase]
public void TestDeleteUser()
{
UserInformationBal userinfobal=new UserInformationBal();
UserInformationDal userinfodal=new UserInformationDal();
userinfodal.UserId = 24;
userinfobal.DeleteUserInformation(userinfodal.UserId);
UserInformationDal user= userinfobal.GetUserInfoById(userinfodal.UserId.ToString());
if(userinfodal.UserId==user.UserId)
{
Assert.IsTrue(false);
}
else
{
Assert.IsTrue(true);
}
}
[TestCase]
public void TestUpdateUser()
{
UserInformationDal userdal=new UserInformationDal();
UserInformationBal userbal=new UserInformationBal();
userdal.Title = "Ms";
userdal.FirstName = "Pooja";
userdal.MiddleName = "Sumit";
userdal.LastName = "Mishra";
userdal.Age = 22;
userdal.DateOfBirth = DateTime.Now;
userdal.Sex = "FeMale";
userdal.Category = "Family";
userdal.UserId = 42;
userbal.UpdateInfo(42);
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AddressBookBal;
using AddressBookDal;
using NUnit.Framework;
namespace TestAddressBook
{
[TestFixture]
class TestUserInformation
{
[TestCase]
public void TestAddNewUser()
{
UserInformationBal userbal=new UserInformationBal();
UserInformationDal userInformationDal=new UserInformationDal();
userInformationDal.Title = "Mr";
userInformationDal.FirstName="Ajay";
userInformationDal.MiddleName = "ramesh";
userInformationDal.LastName = "Sonkul";
userInformationDal.Age = 30;
userInformationDal.DateOfBirth = DateTime.Now;
userInformationDal.Sex = "Male";
userInformationDal.Category = "Family";
String UserId = userbal.AddUserInformation(userInformationDal);
UserInformationDal user = userbal.GetUserInfoById(UserId);
if (user.Title == userInformationDal.Title && user.FirstName == userInformationDal.FirstName && user.MiddleName == userInformationDal.MiddleName && user.LastName == userInformationDal.LastName && user.Age == userInformationDal.Age && user.DateOfBirth == userInformationDal.DateOfBirth && user.Sex == userInformationDal.Sex && user.Category == userInformationDal.Category)
{
Assert.IsTrue(true);
}
else
{
// userbal.GetUserInfoById(UserId);
Assert.IsTrue(false);
}
}
[TestCase]
public void TestDeleteUser()
{
UserInformationBal userinfobal=new UserInformationBal();
UserInformationDal userinfodal=new UserInformationDal();
userinfodal.UserId = 24;
userinfobal.DeleteUserInformation(userinfodal.UserId);
UserInformationDal user= userinfobal.GetUserInfoById(userinfodal.UserId.ToString());
if(userinfodal.UserId==user.UserId)
{
Assert.IsTrue(false);
}
else
{
Assert.IsTrue(true);
}
}
[TestCase]
public void TestUpdateUser()
{
UserInformationDal userdal=new UserInformationDal();
UserInformationBal userbal=new UserInformationBal();
userdal.Title = "Ms";
userdal.FirstName = "Pooja";
userdal.MiddleName = "Sumit";
userdal.LastName = "Mishra";
userdal.Age = 22;
userdal.DateOfBirth = DateTime.Now;
userdal.Sex = "FeMale";
userdal.Category = "Family";
userdal.UserId = 42;
userbal.UpdateInfo(42);
}
}
}
very nice.. thnx :)
ReplyDelete