public void CreateGoods_UseDefaultIdGenerator_Test() { var goodsDomainService = new GoodsDomainService(new DefaultIdGenerator()); var goods = goodsDomainService.CreateGoods("a goods"); goods.Id.ShouldBe(1); }
public void CreateGoods_UseMoqIdGenerator_Throw() { var mock = new Mock <IIdGenerator>(); mock.Setup(generator => generator.Create()).Throws(new NotImplementedException()); var goodsDomainService = new GoodsDomainService(mock.Object); Should.Throw <NotImplementedException>(() => goodsDomainService.CreateGoods("a goods")); }
public void CreateGoods_UseMoqIdGenerator_Test() { var mock = new Mock <IIdGenerator>(); mock.Setup(generator => generator.Create()).Returns(10); var goodsDomainService = new GoodsDomainService(mock.Object); var goods = goodsDomainService.CreateGoods("a goods"); goods.Id.ShouldBe(10); }