本文整理汇总了C#中Service.MethodToTest方法的典型用法代码示例。如果您正苦于以下问题:C# Service.MethodToTest方法的具体用法?C# Service.MethodToTest怎么用?C# Service.MethodToTest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Service
的用法示例。
在下文中一共展示了Service.MethodToTest方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test
public void Test()
{
var repo = new Repository();
var service = new Service(repo);
service.MethodToTest(_model);
}
示例2: TestNsubstitute
public void TestNsubstitute()
{
var mockRepo = Substitute.For<IRepository>();
var service = new Service(mockRepo);
service.MethodToTest(_model);
mockRepo.Received().Save(Arg.Is<DTO>(x => x.Name == _model.Name));
}
示例3: TestMoqComplex
public void TestMoqComplex()
{
var mockRepo = new Mock<IRepository>();
mockRepo.Setup(x => x.Save(It.IsAny<DTO>()));
var service = new Service(mockRepo.Object);
service.MethodToTest(_model);
mockRepo.Verify(x => x.Save(It.Is<DTO>((dto)=>EqualityTest(dto))));
}
示例4: TestMoq
public void TestMoq()
{
var mockRepo = new Mock<IRepository>();
mockRepo.Setup(x => x.Save(It.IsAny<DTO>()));
var service = new Service(mockRepo.Object);
service.MethodToTest(_model);
mockRepo.Verify(x => x.Save(It.Is<DTO>(y => y.Name == "hop")), Times.Once);
}
示例5: TestNsubstituteComplex
public void TestNsubstituteComplex()
{
var mockRepo = Substitute.For<IRepository>();
var service = new Service(mockRepo);
service.MethodToTest(_model);
mockRepo.Received().Save(Arg.Is<DTO>((dto) => EqualityTest(dto)));
}