Exemplo n.º 1
0
        public void SaveItemAsync_ItemNull()
        {
            var urlBuilder = new Mock <IItemWriteUrlBuilder <Uom> >(MockBehavior.Strict).Object;
            var next       = new Mock <ISaveItemServiceBuildRequest <Uom> >(MockBehavior.Strict).Object;
            var uut        = new SaveItemServiceBuildUrl <Uom>(urlBuilder, next);

            Assert.ThrowsAsync <ArgumentNullException>(
                async() => await uut.SaveItemAsync(null)
                );
        }
Exemplo n.º 2
0
        public async Task SaveItemAsync_Id_Non0()
        {
            var uom        = new Uom().WithId(1001);
            var url        = "http://qtb3.com";
            var urlBuilder = new Mock <IItemWriteUrlBuilder <Uom> >(MockBehavior.Strict);

            urlBuilder.Setup(n => n.Build(uom.Id)).Returns(url);
            var next = new Mock <ISaveItemServiceBuildRequest <Uom> >(MockBehavior.Strict);

            next.Setup(n => n.SaveItemAsync(url, uom)).Returns(Task.CompletedTask);
            var uut = new SaveItemServiceBuildUrl <Uom>(urlBuilder.Object, next.Object);
            await uut.SaveItemAsync(uom);
        }