コード例 #1
0
        public async void AddDeviceAsyncTest()
        {
            var device      = fixture.Create <DeviceModel>();
            var deviceWKeys = fixture.Create <DeviceWithKeys>();

            deviceLogic.Setup(mock => mock.AddDeviceAsync(device)).ReturnsAsync(deviceWKeys);
            var res = await deviceApiController.AddDeviceAsync(device);

            res.AssertOnError();
            var data = res.ExtractContentDataAs <DeviceWithKeys>();

            Assert.Equal(data, deviceWKeys);

            await Assert.ThrowsAsync <HttpResponseException>(() => deviceApiController.AddDeviceAsync(null));
        }