public void NullStateShouldThrowException() { ArgumentNullException exception = Assert.Throws <ArgumentNullException>( () => Cigar.Load(null)); Assert.Equal("state", exception.ParamName); }
public void ShouldBindStateToProperties() { CigarState state = new CigarState() { Id = Guid.NewGuid() }; Cigar cigar = Cigar.Load(state); Assert.Equal(state.Id, cigar.Id); }
/// <inheritdoc /> public async Task <Cigar> Load(Guid id) { DynamicParameters parameters = new DynamicParameters(); parameters.Add("@Id", id, DbType.Guid, ParameterDirection.Input); EntityState entityState = await _client.ExecuteInManagedConnectionAsync(connection => connection.QuerySingleOrDefaultAsync <EntityState>( "[Catalog].[Cigars_GetSingle]", parameters, commandType: CommandType.StoredProcedure) ); if (entityState == null) { return(null); } CigarState cigarState = _serializer.Deserialize <CigarState>(entityState.SerializedContent); return(Cigar.Load(cigarState)); }