public void ExistsFor_returns_false_for_nonexistent_model_id() { var sut = new StreamFactory <int, Model>(); var modelId = _fixture.Create <int>(); bool actual = sut.ExistsFor(modelId); actual.Should().BeFalse(); }
public void ExistsFor_returns_true_for_model_id_with_which_stream_created() { var sut = new StreamFactory <int, Model>(); var modelId = _fixture.Create <int>(); IConnection <Model> connection = sut.Connect(modelId); bool actual = sut.ExistsFor(modelId); actual.Should().BeTrue(); }
public void sut_removes_unused_stream() { // Arrange var factory = new StreamFactory <int, Model>(); var modelId = _fixture.Create <int>(); factory.Connect(modelId); // Act GC.Collect(); GC.WaitForPendingFinalizers(); // Assert factory.ExistsFor(modelId).Should().BeFalse(); }