I am writing unit tests using xUnit and Moq. 

My Test class ***TestBlobServiceProvider*** constructor has below code

```
  private readonly Common.Interfaces.IBlobServiceProvider _iblobprovider;
    public TestBlobServiceProvider()
    {

        var mockCloudBlobContainer = new Mock<IBlobOperations>();
        mockCloudBlobContainer.Setup(repo => repo.parseConnString(It.IsAny<string>())).Returns(new CloudStorageAccount(new StorageCredentials(), new Uri("http://mytest"), new Uri("http://mytest"), new Uri("http://mytest"), new Uri("http://mytest")));

        var blobMock = new Mock<CloudBlockBlob>(new Uri("http://tempuri.org/blob"));
        blobMock
            .Setup(m => m.ExistsAsync())
            .ReturnsAsync(true);
        _iblobprovider = new BlobServiceProvider(mockCloudBlobContainer.Object, blobMock.Object);

    }

```

and below is the Test method

```
    [Fact]
    public void DownloadFromBlob_Success()
    {
        string containerName = "d";
        string fileName = "w";
        string downloadPath = "e";
        _iblobprovider.DownloadFromBlob(containerName,fileName,downloadPath);
    }

```

Class **BlobServiceProvider** has below code

```
 public readonly CloudBlobClient blobClient = null;
 private readonly IBlobOperations _blobOperations;
 public   CloudBlockBlob _blockBlob = null;

 public BlobServiceProvider(IBlobOperations blobOperations,CloudBlockBlob  cloudBlockBlob )
        {
            string storageConnectionString="";
            this._blobOperations = blobOperations;
              this._blockBlob= cloudBlockBlob; // this._blockBlob contains ExistsAsync() mock data which was created in TestBlobServiceProvider constructor.How can I return mock data if ExistsAsync() called.
            CloudStorageAccount storageAccount = this._blobOperations.parseConnString(storageConnectionString);
            blobClient = storageAccount.CreateCloudBlobClient();
        }

      public void DownloadFromBlob(string containerName, string fileName, string downloadPath)
        {
            CloudBlockBlob file = GetBlockBlobContainer(containerName).GetBlockBlobReference(fileName);
            var val = ReturnFileValue(file); 
            if (!val)
                throw new FileNotFoundException($"{Messages.ExMethodName} {MethodBase.GetCurrentMethod()} {Messages.ExMessage} {Messages.FileNotFound}");

            file.DownloadToFileAsync(Path.Combine(downloadPath, fileName), FileMode.Create);
        }

      private bool ReturnFileValue(CloudBlockBlob file)
        {
            var value = file.ExistsAsync(); // here I need to return mock data, but I'm not getting how can I use this._blockBlob here

            return value.Result;
        }

```

I know if I use as below in `ReturnFileValue()`, then it will return mocked data. But I can't use below, as I am checking whether file exists or not based on Input `CloudBlockBlob` value of `ReturnFileValue()`.

```
var value = this._blockBlob.ExistsAsync()

```

So, how can I make `var value = file.ExistsAsync();` return mocked data.

Added screenshots for reference.

[![enter image description here](https://i.stack.imgur.com/60GX8.png)](https://i.stack.imgur.com/60GX8.png)
[![enter image description here](https://i.stack.imgur.com/c5dfi.png)](https://i.stack.imgur.com/c5dfi.png)
[![enter image description here](https://i.stack.imgur.com/Ntadi.png)](https://i.stack.imgur.com/Ntadi.png)