Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename SoftDeleteAsync to DeleteAsync #197

Merged
merged 1 commit into from
Feb 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/EventStore.Client.Streams/EventStoreClient.Delete.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
namespace EventStore.Client {
public partial class EventStoreClient {
/// <summary>
/// Soft Deletes a stream asynchronously.
/// Deletes a stream asynchronously.
/// </summary>
/// <param name="streamName">The name of the stream to delete.</param>
/// <param name="expectedRevision">The expected <see cref="StreamRevision"/> of the stream being deleted.</param>
/// <param name="configureOperationOptions">An <see cref="Action{EventStoreClientOperationOptions}"/> to configure the operation's options.</param>
/// <param name="userCredentials">The optional <see cref="UserCredentials"/> to perform operation with.</param>
/// <param name="cancellationToken">The optional <see cref="System.Threading.CancellationToken"/>.</param>
/// <returns></returns>
public Task<DeleteResult> SoftDeleteAsync(
public Task<DeleteResult> DeleteAsync(
string streamName,
StreamRevision expectedRevision,
Action<EventStoreClientOperationOptions>? configureOperationOptions = null,
Expand All @@ -25,19 +25,19 @@ public Task<DeleteResult> SoftDeleteAsync(
var operationOptions = Settings.OperationOptions.Clone();
configureOperationOptions?.Invoke(operationOptions);

return SoftDeleteAsync(streamName, expectedRevision, operationOptions, userCredentials, cancellationToken);
return DeleteAsync(streamName, expectedRevision, operationOptions, userCredentials, cancellationToken);
}

/// <summary>
/// Soft Deletes a stream asynchronously.
/// Deletes a stream asynchronously.
/// </summary>
/// <param name="streamName">The name of the stream to delete.</param>
/// <param name="expectedState">The expected <see cref="StreamState"/> of the stream being deleted.</param>
/// <param name="configureOperationOptions">An <see cref="Action{EventStoreClientOperationOptions}"/> to configure the operation's options.</param>
/// <param name="userCredentials">The optional <see cref="UserCredentials"/> to perform operation with.</param>
/// <param name="cancellationToken">The optional <see cref="System.Threading.CancellationToken"/>.</param>
/// <returns></returns>
public Task<DeleteResult> SoftDeleteAsync(
public Task<DeleteResult> DeleteAsync(
string streamName,
StreamState expectedState,
Action<EventStoreClientOperationOptions>? configureOperationOptions = null,
Expand All @@ -46,10 +46,10 @@ public Task<DeleteResult> SoftDeleteAsync(
var options = Settings.OperationOptions.Clone();
configureOperationOptions?.Invoke(options);

return SoftDeleteAsync(streamName, expectedState, options, userCredentials, cancellationToken);
return DeleteAsync(streamName, expectedState, options, userCredentials, cancellationToken);
}

private Task<DeleteResult> SoftDeleteAsync(
private Task<DeleteResult> DeleteAsync(
string streamName,
StreamState expectedState,
EventStoreClientOperationOptions operationOptions,
Expand All @@ -61,7 +61,7 @@ private Task<DeleteResult> SoftDeleteAsync(
}
}.WithAnyStreamRevision(expectedState), operationOptions, userCredentials, cancellationToken);

private Task<DeleteResult> SoftDeleteAsync(
private Task<DeleteResult> DeleteAsync(
string streamName,
StreamRevision expectedRevision,
EventStoreClientOperationOptions operationOptions,
Expand Down
4 changes: 2 additions & 2 deletions test/EventStore.Client.Streams.Tests/append_to_stream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,12 +313,12 @@ await Assert.ThrowsAsync<StreamDeletedException>(() => _fixture.Client.AppendToS
}

[Fact]
public async Task appending_with_stream_exists_expected_version_to_soft_deleted_stream_throws_stream_deleted() {
public async Task appending_with_stream_exists_expected_version_to_deleted_stream_throws_stream_deleted() {
var stream = _fixture.GetStreamName();

await _fixture.Client.AppendToStreamAsync(stream, StreamState.NoStream, _fixture.CreateTestEvents());

await _fixture.Client.SoftDeleteAsync(stream, StreamState.Any);
await _fixture.Client.DeleteAsync(stream, StreamState.Any);

await Assert.ThrowsAsync<StreamDeletedException>(() => _fixture.Client.AppendToStreamAsync(
stream,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ public deleting_stream_with_timeout(Fixture fixture) {
}

[Fact]
public async Task any_stream_revision_soft_delete_fails_when_operation_expired() {
public async Task any_stream_revision_delete_fails_when_operation_expired() {
var stream = _fixture.GetStreamName();
var rpcException = await Assert.ThrowsAsync<RpcException>(() =>
_fixture.Client.SoftDeleteAsync(stream, StreamState.Any,
_fixture.Client.DeleteAsync(stream, StreamState.Any,
options => options.TimeoutAfter = TimeSpan.Zero));

Assert.Equal(StatusCode.DeadlineExceeded, rpcException.StatusCode);
}

[Fact]
public async Task stream_revision_soft_delete_fails_when_operation_expired() {
public async Task stream_revision_delete_fails_when_operation_expired() {
var stream = _fixture.GetStreamName();

var rpcException = await Assert.ThrowsAsync<RpcException>(() =>
_fixture.Client.SoftDeleteAsync(stream, new StreamRevision(0),
_fixture.Client.DeleteAsync(stream, new StreamRevision(0),
options => options.TimeoutAfter = TimeSpan.Zero));

Assert.Equal(StatusCode.DeadlineExceeded, rpcException.StatusCode);
Expand Down
6 changes: 3 additions & 3 deletions test/EventStore.Client.Streams.Tests/deleting_stream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public async Task soft_deleting_a_stream_that_exists() {

await _fixture.Client.AppendToStreamAsync(stream, StreamRevision.None, _fixture.CreateTestEvents());

await _fixture.Client.SoftDeleteAsync(stream, StreamState.StreamExists);
await _fixture.Client.DeleteAsync(stream, StreamState.StreamExists);
}

[Fact]
Expand All @@ -46,7 +46,7 @@ public async Task soft_deleting_a_stream_that_does_not_exist_with_wrong_expected
var stream = _fixture.GetStreamName();

await Assert.ThrowsAsync<WrongExpectedVersionException>(
() => _fixture.Client.SoftDeleteAsync(stream, new StreamRevision(0)));
() => _fixture.Client.DeleteAsync(stream, new StreamRevision(0)));
}

[Fact]
Expand All @@ -72,7 +72,7 @@ public async Task soft_deleting_a_stream_should_return_log_position() {
StreamState.NoStream,
_fixture.CreateTestEvents());

var deleteResult = await _fixture.Client.SoftDeleteAsync(stream, writeResult.NextExpectedStreamRevision);
var deleteResult = await _fixture.Client.DeleteAsync(stream, writeResult.NextExpectedStreamRevision);

Assert.True(deleteResult.LogPosition > writeResult.LogPosition);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ await Client.AppendToStreamAsync(LinkedStream, StreamState.Any, new[] {
Array.Empty<byte>(), Constants.Metadata.ContentTypes.ApplicationOctetStream)
});

await Client.SoftDeleteAsync(DeletedStream, StreamState.Any);
await Client.DeleteAsync(DeletedStream, StreamState.Any);
}

protected override async Task When() {
Expand Down
20 changes: 10 additions & 10 deletions test/EventStore.Client.Streams.Tests/soft_deleted_stream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

namespace EventStore.Client {
[Trait("Category", "LongRunning")]
public class soft_deleted_stream : IClassFixture<soft_deleted_stream.Fixture> {
public class deleted_stream : IClassFixture<deleted_stream.Fixture> {
private readonly Fixture _fixture;
private readonly JsonDocument _customMetadata;

public soft_deleted_stream(Fixture fixture) {
public deleted_stream(Fixture fixture) {
_fixture = fixture;

var customMetadata = new Dictionary<string, object> {
Expand All @@ -33,7 +33,7 @@ public async Task reading_throws() {

Assert.Equal(new StreamRevision(0), writeResult.NextExpectedStreamRevision);

await _fixture.Client.SoftDeleteAsync(stream, writeResult.NextExpectedStreamRevision);
await _fixture.Client.DeleteAsync(stream, writeResult.NextExpectedStreamRevision);

await Assert.ThrowsAsync<StreamNotFoundException>(
() => _fixture.Client.ReadStreamAsync(Direction.Forwards, stream, StreamPosition.Start)
Expand All @@ -57,7 +57,7 @@ public async Task recreated_with_any_expected_version(

Assert.Equal(new StreamRevision(0), writeResult.NextExpectedStreamRevision);

await _fixture.Client.SoftDeleteAsync(stream, writeResult.NextExpectedStreamRevision);
await _fixture.Client.DeleteAsync(stream, writeResult.NextExpectedStreamRevision);

var events = _fixture.CreateTestEvents(3).ToArray();

Expand Down Expand Up @@ -93,7 +93,7 @@ public async Task recreated_with_expected_version() {

Assert.Equal(new StreamRevision(0), writeResult.NextExpectedStreamRevision);

await _fixture.Client.SoftDeleteAsync(stream, writeResult.NextExpectedStreamRevision);
await _fixture.Client.DeleteAsync(stream, writeResult.NextExpectedStreamRevision);

var events = _fixture.CreateTestEvents(3).ToArray();

Expand Down Expand Up @@ -173,7 +173,7 @@ await _fixture.Client.AppendToStreamAsync(stream, StreamState.NoStream,

Assert.Equal(new StreamRevision(1), writeResult.NextExpectedStreamRevision);

await _fixture.Client.SoftDeleteAsync(stream, new StreamRevision(1));
await _fixture.Client.DeleteAsync(stream, new StreamRevision(1));

await _fixture.Client.TombstoneAsync(stream, StreamState.Any);

Expand Down Expand Up @@ -202,7 +202,7 @@ await _fixture.Client.AppendToStreamAsync(stream, StreamState.NoStream,

Assert.Equal(new StreamRevision(1), writeResult.NextExpectedStreamRevision);

await _fixture.Client.SoftDeleteAsync(stream, new StreamRevision(1));
await _fixture.Client.DeleteAsync(stream, new StreamRevision(1));

writeResult = await _fixture.Client.AppendToStreamAsync(stream, StreamState.NoStream,
_fixture.CreateTestEvents(3));
Expand All @@ -223,7 +223,7 @@ public async Task allows_recreating_for_first_write_only_returns_wrong_expected_

Assert.Equal(new StreamRevision(1), writeResult.NextExpectedStreamRevision);

await _fixture.Client.SoftDeleteAsync(stream, new StreamRevision(1));
await _fixture.Client.DeleteAsync(stream, new StreamRevision(1));

writeResult = await _fixture.Client.AppendToStreamAsync(stream, StreamState.NoStream,
_fixture.CreateTestEvents(3));
Expand All @@ -246,7 +246,7 @@ await _fixture.Client.AppendToStreamAsync(stream, StreamState.NoStream,

Assert.Equal(new StreamRevision(1), writeResult.NextExpectedStreamRevision);

await _fixture.Client.SoftDeleteAsync(stream, new StreamRevision(1));
await _fixture.Client.DeleteAsync(stream, new StreamRevision(1));

var firstEvents = _fixture.CreateTestEvents(3).ToArray();
var secondEvents = _fixture.CreateTestEvents(2).ToArray();
Expand Down Expand Up @@ -325,7 +325,7 @@ public async Task recreated_on_non_empty_when_metadata_set() {

Assert.Equal(new StreamRevision(1), writeResult.NextExpectedStreamRevision);

await _fixture.Client.SoftDeleteAsync(stream, writeResult.NextExpectedStreamRevision);
await _fixture.Client.DeleteAsync(stream, writeResult.NextExpectedStreamRevision);

writeResult = await _fixture.Client.SetStreamMetadataAsync(
stream,
Expand Down