jeudi 21 mai 2015

Adding item Unit Test

I'm having this issue that confuses me for long time.I'm having an item and i'm adding it to the database using this method

 public Messages addItem(Item item)
        {
            Messages resultMessage = Messages.Success;

            using (IUnitOfWork unitOfWork = new UnitOfWork())
            {
                IItemRepository itemRep = new ItemRepository(unitOfWork);

                try
                {
                    itemRep.Insert(item);

                    unitOfWork.Commit();
                }

                catch (Exception e)
                {
                    Console.WriteLine(e.StackTrace);
                    resultMessage = Messages.DB_Failure;
                }


            }

            return resultMessage;
        }

Now i have to make an unit test for it to check if this item is added to the database but i have no idea how should i do that? Could someone helps me?

Aucun commentaire:

Enregistrer un commentaire