Require UnitTest case for MVVM

2 posts, 0 answers
  1. Suman Rao
    Suman Rao avatar
    16 posts
    Member since:
    Aug 2009

    Posted 11 Aug 2010 Link to this post

    Some sample test code, any one

    I am new to JockMock tool in silverlight and need a sample unit test case for ViewModel in MVVM
    Below is method that is part of ViewModel

     

    public void Save()

     

    {

     

     

        string serializedTradeObjects = string.Empty;

     

     

     

        if (_reviewedTradeContext.HasChanges) // RIA.Context

     

        {

     

     

            if (_reviewedTradeContext.EntityContainer.GetChanges().ModifiedEntities.Count > 0)

     

        {

     

     

            this.IsBusy = true;

     

     

     

            var modifications = _reviewedTradeContext.EntityContainer.GetChanges().ModifiedEntities;

     

     

     

            List<Trade> tradeList = new List<Trade>();

     

     

     

            foreach (Entity trade in modifications)

     

            {

                tradeList.Add((

     

    Trade)trade);

     

            }

            serializedTradeObjects = tradeList.Serialize();

         }

     

     

            InvokeOperation<string> reviewTradesInvokeOperation = _reviewedTradeContext.UploadTrades(serializedTradeObjects, String.Empty, String.Empty);

     

        reviewTradesInvokeOperation.Completed +=

     

    new EventHandler(reviewTradesInvokeOperation_Completed);

     

        }

    }

    Can some one provide me the Unit Test case in Jock Mock

    Cheers,
    Suman

     

  2. Ricky
    Admin
    Ricky avatar
    467 posts

    Posted 13 Aug 2010 Link to this post

    Hello Suman,

    Unfortunately, looking at that specific method it will be hard to write a unit test, because I don't know the actual business logic associated with it. To get started with JustMock I would suggest to check our product documentation (also available here: http://www.telerik.com/help/justmock/introduction.html) and also the examples provided in %PROGAMFILES\Telerik\JustMock\Examples.

    Regards,
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft R3 2016 release webinar banner
Back to Top