Monday, December 07, 2009

Self Code testing - FxCop 1.36

I wanted to test my codes are written correctly what Microsoft's defined.So I prepared a class library for Banking Transaction.Before testing this my BankTransaction.dll

Simply I test my codes against Design Rules,Naming Rules,Interoperability Rules,Performance and Portability Rules.

My codes were

using System;
using System.Collections.Generic;
using System.Text;

namespace SP.MyBankTransaction
{

public class BankTransactionClass
{
private string account_holder_name;
private string account_number;
private double deposit_amount;
private double withdraw_amount;
private double balance_amount;
public string AccountHolderName
{
get { return account_holder_name; }
set { account_holder_name = valu; }
}
public string AccountNumber
{
get { return account_number; }
set { account_number=value; }
}
public double WithdrawAmount
{
get { return withdraw_amount; }
set { withdraw_amount = value; }
}
public double DepositAmount
{
get { return deposit_amount; }
set { deposit_amount =value; }
}

public double BalanceAmount
{
get { return balance_amount; }
set { balance_amount=value; }
}
public double DepositTrasaction(string FromAccount, double AmountToBeDeposited)
{
FromAccount = AccountNumber;
AmountToBeDeposited = DepositAmount;
return BalanceAmount + AmountToBeDeposited;

}
}

}






Resolution were

Correct the spelling of 'Trasaction' in member name 'BankTransactionClass.DepositTrasaction(string, double)' or remove it entirely if it represents any sort of Hungarian notation.

in line 43,Method name has been misspelled,I changed.Notice the "Transaction".
in line 42,Parameters were Pascal-cased word,I changed to camel cased.
in line 16,Compound Word "AccountHolderName" changed as "Accountholder.

My corrected Code is

using System;
using System.Collections.Generic;
using System.Text;

namespace SP.MyBankTransaction
{

public class BankTransactionClass
{
private string account_holder_name="";
private string account_number="";
private double deposit_amount=0.0;
private double withdraw_amount=0.0;
private double balance_amount=0.0;

public string Accountholder
{
get { return account_holder_name; }
set { value = account_holder_name; }
}
public string AccountNumber
{
get { return account_number; }
set { value = account_number; }
}
public double WithdrawAmount
{
get { return withdraw_amount; }
set { value = withdraw_amount; }
}
public double DepositAmount
{
get { return deposit_amount; }
set { value = deposit_amount; }
}

public double BalanceAmount
{
get { return balance_amount; }
set { value = balance_amount; }
}
public double DepositTransaction(string fromAccount, double amountToBeDeposited)
{
fromAccount = AccountNumber;
amountToBeDeposited = DepositAmount;
return BalanceAmount + amountToBeDeposited;

}
}

}