Esempio n. 1
0
        public async Task <ActionResult> All()
        {
            IReadOnlyCollection <FirebaseObject <Auction> > results;

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

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

            var results = await _adminControllerQueryEntity.All();

            Assert.NotEmpty(results);
            Assert.Equal(mocks.Count, results.Count);
            Assert.IsType <FirebaseObject <MockFirebasePerson> >(results.First());
            Assert.Equal(mocks.First().Object.Name, results.First().Object.Name);
            Assert.Equal(mocks.Last().Object.Name, results.Last().Object.Name);
            Assert.Collection(results, item => Assert.Contains("Johnathan Doe", item.Object.Name),
                              item => Assert.Contains("Johanna Doe", item.Object.Name),
                              item => Assert.Contains("John Clayton", item.Object.Name),
                              item => Assert.Contains("Jane Porter", item.Object.Name));
        }