public async void CreateReadUpdateDelete() { //Post var person = _fixture.PersonList.ElementAt(3); var postResult = await _adminControllerQueryEntity.Post(person); Assert.NotNull(postResult); Assert.IsType <FirebaseObject <MockFirebasePerson> >(postResult); Assert.Equal(person.Name, postResult.Object.Name); //Get var getResult = await _adminControllerQueryEntity.Get(postResult.Key); Assert.NotNull(getResult); Assert.IsType <MockFirebasePerson>(getResult); Assert.Equal(person.Name, getResult.Name); //Put person.Name = "Johnathan Doe"; person.Age = 25; var putResult = await _adminControllerQueryEntity.Put(postResult.Key, person); Assert.NotNull(putResult); Assert.IsType <MockFirebasePerson>(putResult); getResult = await _adminControllerQueryEntity.Get(postResult.Key); Assert.NotNull(getResult); Assert.IsType <MockFirebasePerson>(getResult); Assert.Equal(person.Name, getResult.Name); Assert.Equal(person.Age, getResult.Age); Assert.Equal(person.Gender, getResult.Gender); //Delete await _adminControllerQueryEntity.Delete(postResult.Key); getResult = await _adminControllerQueryEntity.Get(postResult.Key); Assert.Null(getResult); }
public async Task <ActionResult> Get(string key) { Auction result; if (this.IsAdministrator()) { result = await _adminAuctionQuery.Get(key); } else { result = await _userAuctionQuery.Get(key); } return(null != result ? this.Ok(JsonConvert.SerializeObject(result)) : this.NotFound($"{key} not found!")); }