コード例 #1
0
        public BirdServiceTest()
        {
            _repositoryMock = Substitute.For <IBirdRepository>();
            _validatorMock  = Substitute.For <IBirdValidator>();

            _sut = new BirdService(_validatorMock, _repositoryMock);
        }
コード例 #2
0
        //public ActionResult Alphabetically(string name)
        //{
        //    return Content
        //}

        private BirdService CreateBirdService()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new BirdService(userId);

            return(service);
        }
コード例 #3
0
 public Archaeomania()
 {
     _birdService = new BirdService();
     _unitOfMeasurementService = new UnitOfMeasurementService();
     FromUm = Enums.UnitOfMeasurement.Milliarchieops;
     InitializeComponent();
 }
コード例 #4
0
        // GET: Bird
        public ActionResult Index(string sortOrder, string searchString)
        {
            //var userId = Guid.Parse(User.Identity.GetUserId());
            //var service = new BirdService(userId);
            //var model = service.GetBirds();
            //return View(model);

            ViewBag.NameSortParm           = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ViewBag.MainColorSortParm      = sortOrder == "mainColor" ? "mainColor_desc" : "mainColor";
            ViewBag.SecondaryColorSortParm = sortOrder == "secondaryColor" ? "secondaryColor_desc" : "secondaryColor";
            ViewBag.CountyNameSortParm     = sortOrder == "countyName" ? "countyName_desc" : "countyName";

            BirdService service = CreateBirdService();
            var         model   = service.SortBirds(sortOrder, searchString);

            return(View(model));
        }
コード例 #5
0
        async Task ExecuteLoadBirdsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                KnownBirds.Clear();
                var _birds = await BirdService.GetKnownBirdsAsync();

                foreach (var tmpBird in _birds)
                {
                    KnownBird tmpKB = new KnownBird();

                    tmpKB.BirdID         = tmpBird.BirdID;
                    tmpKB.Name           = tmpBird.Name;
                    tmpKB.examplePicture = tmpBird.examplePicture;
                    tmpKB.displayName    = tmpBird.displayName;

                    //Change this to URL when setting this from the REST API and not the local data.
                    //tmpKB.BirdImage = ImageSource.FromResource("BirdWatcherMobileApp.SampleData.images." + tmpBird.examplePicture);

                    tmpKB.BirdImage = new UriImageSource {
                        CachingEnabled = false, Uri = new Uri("http://" + Settings.ServerAddress + "/images/bird_examples/" + tmpBird.examplePicture)
                    };

                    KnownBirds.Add(tmpKB);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
コード例 #6
0
        private async void LoadBirdLog(long birdLogID)
        {
            var birdLog = await BirdWatcherLogService.GetBirdLogAsync(birdLogID);

            if (Settings.UseMetric)
            {
                LogTemp = birdLog.temperature.ToString() + "C";
            }
            else
            {
                LogTemp = ConvertCelsiusToFahrenheit(birdLog.temperature).ToString() + "F";
            }

            LogDate = birdLog.timestamp.ToString("MM/dd/yyyy");

            if (Settings.Use24Hour)
            {
                LogTime = birdLog.timestamp.ToString("HH:mm");
            }
            else
            {
                LogTime = birdLog.timestamp.ToString("hh:mm tt");
            }

            if (!String.IsNullOrEmpty(birdLog.picture))
            {
                LogImage = new UriImageSource {
                    CachingEnabled = false, Uri = new Uri("http://" + Settings.ServerAddress + "/images/captured/" + birdLog.picture)
                };
            }

            foreach (int x in birdLog.birds)
            {
                var knownBird = await BirdService.GetKnownBirdAsync(x);

                BirdsFound.Add(knownBird.Name);
            }
        }
コード例 #7
0
 public void Setup()
 {
     _subject = new BirdService();
 }
コード例 #8
0
 public override void Execute()
 {
     BirdService.Request("//");
     BirdService.dispatcher.AddListener(Events.Highest_Score_Over, OnComplete);
 }