Exemple #1
0
        public async Task <ActionResult> Some(string key)
        {
            IReadOnlyCollection <FirebaseObject <Auction> > results;

            if (this.IsAdministrator())
            {
                results = await _adminAuctionQuery.Newest(key);
            }
            else
            {
                results = await _userAuctionQuery.Newest(key);
            }
            return(this.Ok(JsonConvert.SerializeObject(results)));
        }
        public async void NewestOldest()
        {
            var mocks = await CreateMocks();

            Assert.True(mocks.Any(), "Fail to create mocks");

            var newestResults = await _adminControllerQueryEntity.Newest("2");

            Assert.NotEmpty(newestResults);
            Assert.Equal(2, newestResults.Count);
            Assert.IsType <FirebaseObject <MockFirebasePerson> >(newestResults.First());
            Assert.Equal("Jane Porter", newestResults.ToList().ElementAt(0).Object.Name);
            Assert.Equal("John Clayton", newestResults.ToList().ElementAt(1).Object.Name);

            var oldestResults = await _adminControllerQueryEntity.Oldest("2");

            Assert.NotEmpty(oldestResults);
            Assert.Equal(2, oldestResults.Count);
            Assert.IsType <FirebaseObject <MockFirebasePerson> >(oldestResults.First());
            Assert.Equal("Johnathan Doe", oldestResults.ToList().ElementAt(0).Object.Name);
            Assert.Equal("Johanna Doe", oldestResults.ToList().ElementAt(1).Object.Name);
        }