public virtual void CanAddAndGetGrant() { using (var uow = DataService.StartUnitOfWork()) { var grant = new GrantEntity { ClientId = "fluitec.appfx.lkjsadlkjsalkjaslkjdasd", CreationTime = DateTime.Now, Data = "Data", GrantKey = "MyKey", SubjectId = Guid.NewGuid().ToString(), Type = "Type" }; uow.GrantRepository.Add(grant); Assert.AreEqual(grant.Data, uow.GrantRepository.Get(grant.Id).Data); } }
/// <summary> Stores the asynchronous. </summary> /// <param name="grant"> The grant. </param> /// <returns> A Task. </returns> public Task StoreAsync(PersistedGrant grant) { return(Task.Factory.StartNew(() => { using (var uow = _dataService.StartUnitOfWork()) { var entity = new GrantEntity { GrantKey = grant.Key, ClientId = grant.ClientId, CreationTime = grant.CreationTime, Data = grant.Data, Expiration = grant.Expiration, SubjectId = grant.SubjectId, Type = grant.Type }; uow.GrantRepository.Add(entity); uow.Commit(); } })); }