Beispiel #1
0
        public async Task GetItemNull()
        {
            var srv = CreateMock <IItemService>();

            var ctrl = new DynItemController(srv);
            var all  = await ctrl.Get(10);

            all.Should().BeNull();
        }
Beispiel #2
0
        public async Task GetItem()
        {
            var srv = CreateMock <IItemService>();

            srv.Get(1).Returns(new Item {
                ItemId = 1, Name = "Test1"
            });

            var ctrl = new DynItemController(srv);
            var all  = await ctrl.Get(1);

            all.Should().
            BeEquivalentTo(new
            {
                ItemId = 1,
                Name   = "Test1"
            }, options => options.ExcludingMissingMembers());
        }
Beispiel #3
0
        public async Task GetItem()
        {
            var srv = CreateMock <IItemService>();

            srv.Get(1).Returns(new Item {
                ItemID = 1, Name = "Test1"
            });

            var ctrl = new DynItemController(srv);
            var all  = await ctrl.Get(1);

            all.ShouldBeEquivalentTo(
                new
            {
                ItemID = 1,
                Name   = "Test1"
            }
                );
        }