public void GetAllFireDataViaMoqServiceWithValue()
        {
            _fireBanData = _fireBanServiceMoq.GetAllFireBanData();

            Assert.AreEqual(_fireBanData.Count, 2);
            Assert.AreEqual(_fireBanData[0].district, "Far North Coast");
        }
        public void initializeTest()
        {
            _fireBanServiceMoq = Substitute.For <IFireBanAppService>();
            _fireBanServiceMoq.GetAllFireBanData().Returns(new List <FireBanData> {
                new FireBanData {
                    district            = "Far North Coast",
                    regionNumber        = 1,
                    councils            = "Ballina; Byron; Clarence Valley; Kyogle; Lismore; Richmond Valley; Tweed",
                    dangerLevelToday    = "LOW MODERATE",
                    dangerLevelTomorrow = "LOW MODERATE",
                    fireBanToday        = false,
                    fireBanTomorrow     = false
                },
                new FireBanData {
                    district            = "Illawarra/Shoalhaven",
                    regionNumber        = 5,
                    councils            = "Kiama; Shellharbour; Shoalhaven; Wingecarribee; Wollondilly; Wollongong",
                    dangerLevelToday    = "LOW MODERATE",
                    dangerLevelTomorrow = "LOW MODERATE",
                    fireBanToday        = false,
                    fireBanTomorrow     = false
                }
            });

            _fireBanEmptyServiceMoq = Substitute.For <IFireBanAppService>();
            _fireBanEmptyServiceMoq.GetAllFireBanData().Returns(new List <FireBanData> {
            });

            _fireBanRepository = new FireBanRepo();
            _fireBanService    = new FireBanAppService(_fireBanRepository);
        }
        public void initializeTest()
        {
            _fireBanServiceMoq = Substitute.For <IFireBanAppService>();
            _fireBanServiceMoq.GetAllFireBanData().Returns(new List <FireBanData> {
                new FireBanData {
                    district            = "Far North Coast",
                    regionNumber        = 1,
                    councils            = "Ballina; Byron; Clarence Valley; Kyogle; Lismore; Richmond Valley; Tweed",
                    dangerLevelToday    = "LOW MODERATE",
                    dangerLevelTomorrow = "LOW MODERATE",
                    fireBanToday        = false,
                    fireBanTomorrow     = false
                },
                new FireBanData {
                    district            = "Illawarra/Shoalhaven",
                    regionNumber        = 5,
                    councils            = "Kiama; Shellharbour; Shoalhaven; Wingecarribee; Wollondilly; Wollongong",
                    dangerLevelToday    = "LOW MODERATE",
                    dangerLevelTomorrow = "LOW MODERATE",
                    fireBanToday        = false,
                    fireBanTomorrow     = false
                }
            });
            _fireBanCtlMoq = new FireDataController(_fireBanServiceMoq);


            _fireBanEmptyServiceMoq = Substitute.For <IFireBanAppService>();
            _fireBanEmptyServiceMoq.GetAllFireBanData().Returns(new List <FireBanData> {
            });
            _fireBanCtlwithEmptyServ = new FireDataController(_fireBanEmptyServiceMoq);

            _fireBanRepository = new FireBanRepo();
            _fireBanService    = new FireBanAppService(_fireBanRepository);
            _fireBanCtl        = new FireDataController(_fireBanService);


            _client = new HttpClient();

            _client.BaseAddress = new Uri(ServiceBaseURL);

            UrlResponse = _client.GetAsync("api/FireData").Result;
        }
Esempio n. 4
0
        public IHttpActionResult Get()
        {
            bool   isSuccess = false;
            string msg       = "FireBan data is Empty";

            Dto.FireBanResult fireBanResult = new Dto.FireBanResult();
            fireBanResult.fireBanData = new List <Dto.FireBanData>();
            fireBanResult.message     = msg;
            fireBanResult.success     = isSuccess;

            List <Dto.FireBanData> fireBanData = _mService.GetAllFireBanData();

            if (fireBanData.Count > 0)
            {
                isSuccess = true;

                fireBanResult.fireBanData = fireBanData;
                fireBanResult.message     = "Success";
                fireBanResult.success     = isSuccess;
            }

            return(Ok(fireBanResult));
        }
 public void GetAllFireDataViaRepo()
 {
     _fireBanData = _fireBanService.GetAllFireBanData();
     Assert.GreaterOrEqual(_fireBanData.Count, 0);
 }
 public void GetEmptyFireDataViaMoqedService()
 {
     _fireBanData = _fireBanEmptyServiceMoq.GetAllFireBanData();
     Assert.IsTrue(true);
     Assert.AreEqual(_fireBanData.Count, 0);
 }