This is a migrated thread and some comments may be shown as answers.

Require UnitTest case for MVVM

1 Answer 74 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Suman Rao
Top achievements
Rank 1
Suman Rao asked on 11 Aug 2010, 10:17 AM
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

 

1 Answer, 1 is accepted

Sort by
0
Ricky
Telerik team
answered on 13 Aug 2010, 05:21 PM
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
Tags
General Discussions
Asked by
Suman Rao
Top achievements
Rank 1
Answers by
Ricky
Telerik team
Share this question
or