public void When_Unregister_called_with_registered_MockService_Then_removes_MockService() { var mockService = new MockService(); MockServiceRepository.Unregister(mockService); MockServiceRepository.GetServiceMockById(mockService.ServiceId) .Should().BeNull("Because the mockService was unregistered"); }
public void When_GetServiceMockById_called_with_registered_port_Then_returns_registered_MockService() { var mockService = new MockService(); MockServiceRepository.GetServiceMockById(mockService.ServiceId) .Should().Be(mockService, "Because the MockService self-registered."); MockServiceRepository.Unregister(mockService); }
public void When_Unregister_called_with_unregistered_MockService_Then_throws_with_useful_message() { var mockService = new MockService(); MockServiceRepository.Unregister(mockService); Action unregister = () => MockServiceRepository.Unregister(mockService); unregister .ShouldThrow <InvalidOperationException>("Because that MockService was not registered") .WithMessage("MokService not registered", "Because that helps debug the issue"); }