Protected members
Last updated
mock.Protected()
.Setup("Step1")
.Callback(() => TestContext.Progress.Writeline("Step1"));mock.Protected()
.Setup("Step2", ItExpr.IsAny<string>())
.Callback((string value) => TestContext.Progress.Writeline($"Step2: {value}"));mock.Protected()
.SetupGet<int>("Count")
.Returns(42);
mock.Protected()
.SetupSet<int>("Count", ItExpr.IsAny<int>())
.Callback((int value) => TestContext.Progress.Writeline($"Count set to {value}"));public interface IServiceBaseMapping
{
void Step1();
void Step2(string value);
int Count { get; set; }
}mock.Protected()
.As<IServiceBaseMapping>()
.Setup(p => p.Step1())
.Callback(() => TestContext.Progress.Writeline("Step1"));mock.Protected()
.As<IServiceBaseMapping>()
.Setup(p => p.Step2(It.IsAny<string>()))
.Callback((string value) => TestContext.Progress.Writeline($"Step2: {value}"));mock.Protected()
.As<IServiceBaseMapping>()
.SetupProperty(p => p.Count, 42);