dimanche 29 novembre 2015

How to mock GetView operation of couchbase .net SDK

I am trying to write unit test for a method which executes a view on the couch base server using .NET SDK, but unable to mock the o/p.

Method :-

  public int CountJsonDocs()
        {
            int savedFiles = 0;
            var viewResult = _couchbaseClient.GetView("GetAllDocs", "GetAllDocuments");
            if (viewResult.TotalRows > 0)
            {
                foreach (var viewRow in viewResult)
                {
                    var jsonData = viewRow.GetItem();
                    savedFiles++;
                }
            }
            return savedFiles;
        }

GetView() method returns an object of type IView

Aucun commentaire:

Enregistrer un commentaire