Exemplo n.º 1
0
        public void CreateGoods_UseDefaultIdGenerator_Test()
        {
            var goodsDomainService = new GoodsDomainService(new DefaultIdGenerator());

            var goods = goodsDomainService.CreateGoods("a goods");

            goods.Id.ShouldBe(1);
        }
Exemplo n.º 2
0
        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"));
        }
Exemplo n.º 3
0
        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);
        }