Beispiel #1
0
        public async void GetApplicableDeviceCountByMethodTest()
        {
            var filter = fixture.Create <DeviceListFilter>();

            dynamic method = new ExpandoObject();

            method.methodName = "mockname";
            method.parameters = new List <ExpandoObject>();

            deviceManager.Setup(mock => mock.GetDeviceCountAsync(It.IsAny <string>(), It.IsAny <string>()))
            .ReturnsAsync(100);
            deviceManager.Setup(mock => mock.GetDeviceCountAsync(It.Is <string>(p => p.Contains("is_defined")), It.IsAny <string>()))
            .ReturnsAsync(80);
            devicefilterRepository.Setup(mock => mock.GetFilterAsync(It.IsAny <string>()))
            .ReturnsAsync(filter);

            System.Net.Http.HttpResponseMessage res = await deviceApiController.GetApplicableDeviceCountByMethod("mockfilterId", method);

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

            Assert.Equal(80, data.Applicable);
            Assert.Equal(100, data.Total);
        }