Exemplo n.º 1
0
        public async Task GetActiveMeterReading_returns_active_readings()
        {
            var client = new Mock <IXellentAPI>();
            var config = new Mock <IConfig>();

            var entry = new MeterReadingOrder();
            var list  = new List <MeterReadingOrder>()
            {
                entry
            };

            client.Setup(s => s.getactiveMeterReadings(It.IsAny <ActiveMeterReadingRequest>())).
            Returns(new MeterReadingOrderResponse()
            {
                MeterReadingOrders = list.ToArray()
            });

            var service = new MeterReadingSoapService(client.Object, config.Object);

            var activeReading = new MeterReadingOrder();

            var result = await service.GetActiveMeterReadingsAsync();

            Assert.True(result.Item1);
            Assert.NotNull(result.Item2);
        }
Exemplo n.º 2
0
        public async Task GetActiveMeterReading_given_no_active_readings_returns_false()
        {
            var client = new Mock <IXellentAPI>();
            var config = new Mock <IConfig>();

            var entry = new MeterReadingOrder();
            var list  = new List <MeterReadingOrder>()
            {
                entry
            };

            client.Setup(s => s.getactiveMeterReadings(It.IsAny <ActiveMeterReadingRequest>()))
            .Throws <Exception>();

            var service = new MeterReadingSoapService(client.Object, config.Object);

            var activeReading = new MeterReadingOrder();

            var result = await service.GetActiveMeterReadingsAsync();

            Assert.False(result.Item1);
            Assert.Null(result.Item2);
        }