Exemple #1
0
        public async Task GetRoad_NoData_ReturnsRoad()
        {
            var data = new Mock <ITflClient>();

            data.Setup(d => d.Get("A2")).Returns(Task.FromResult((RoadData)null));

            var service = new RoadService(data.Object);

            var road = await service.GetStatus("A2");

            Assert.IsNull(road);
        }
Exemple #2
0
        public async Task GetRoad_WithData_SetsDescription()
        {
            var data = new Mock <ITflClient>();

            const string name = "A4";

            data.Setup(d => d.Get(name)).Returns(Task.FromResult(new RoadData {
                displayName = name, statusSeverityDescription = "Lots of delays"
            }));
            var service = new RoadService(data.Object);

            var road = await service.GetStatus(name);

            Assert.AreEqual("Lots of delays", road.Description);
        }
Exemple #3
0
        public async Task GetRoad_WithData_SetsName()
        {
            var data = new Mock <ITflClient>();

            const string name = "A4";

            data.Setup(d => d.Get(name)).Returns(Task.FromResult(new RoadData {
                displayName = name
            }));
            var service = new RoadService(data.Object);

            var road = await service.GetStatus(name);

            Assert.AreEqual(name, road.Name);
        }