mercredi 8 juillet 2015

How to Mock SetupGet as any value but not null

public interface IProduct
{
    string ProductName { get; set; }
}

[TestMethod]
public void Test_That_WhatEver()
{
    Mock<IProduct> productMock = new Mock<IProduct>(MockBehavior.Strict);

    productMock.SetupGet(x => x.ProductName).Returns( /* Any string value which is not null? */);
}

How to SetupGet with string not null any value?

Aucun commentaire:

Enregistrer un commentaire