public void Complete_should_throw_when_saga_not_found() { var partitionKey = Guid.NewGuid().ToString("N"); var id = Guid.NewGuid().ToString("N"); //arrange var sagaStore = new SqlServerSagaStore(DatabaseInitializer.ConnectionString, new JsonMessageSerializer()); //act & assert sagaStore.Awaiting(x => x.Complete(partitionKey, id)).Should().Throw <SagaNotFoundException>(); }
public void Should_throw_when_get_and_saga_does_not_exist() { var partitionKey = Guid.NewGuid().ToString("N"); var id = Guid.NewGuid().ToString("N"); //arrange var sagaStore = new SqlServerSagaStore(DatabaseInitializer.ConnectionString, new JsonMessageSerializer()); //act & assert sagaStore.Awaiting(x => x.GetSaga <SagaData>(partitionKey, id)).Should().Throw <SagaNotFoundException>(); }
public async Task Should_throw_when_create_and_saga_exists() { var partitionKey = Guid.NewGuid().ToString("N"); var id = Guid.NewGuid().ToString("N"); //arrange var sagaStore = new SqlServerSagaStore(DatabaseInitializer.ConnectionString, new JsonMessageSerializer()); await sagaStore.Create(partitionKey, id, new SagaData { Message = "yo" }); //act & assert sagaStore.Awaiting(x => x.Create(partitionKey, id, new SagaData { Message = "yo" })).Should().Throw <SagaAlreadyStartedException>(); }
public async Task Complete_should_delete_the_saga() { var partitionKey = Guid.NewGuid().ToString("N"); var id = Guid.NewGuid().ToString("N"); //arrange var sagaStore = new SqlServerSagaStore(DatabaseInitializer.ConnectionString, new JsonMessageSerializer()); await sagaStore.Create(partitionKey, id, new SagaData { Message = "yo" }); //act await sagaStore.Complete(partitionKey, id); //assert sagaStore.Awaiting(x => x.GetSaga <SagaData>(partitionKey, id)).Should().Throw <SagaNotFoundException>(); }