public void When_cretated_Then_it_registers_itself_with_the_MockServiceRepository() { using (var mockService = new MockService()) { MockServiceRepository.GetServiceMockById(mockService.ServiceId) .Should().Be(mockService, "Because the MockService should be registered at its port number."); } }
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_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_disposed_Then_it_removes_itself_from_the_MockServiceRepository() { var serviceId = String.Empty; using (var mockService = new MockService()) { serviceId = mockService.ServiceId; } MockServiceRepository.GetServiceMockById(serviceId) .Should().BeNull("Because the MockService should unregister itself during disposal."); }
public void When_GetServiceMockById_called_with_unregistered_Id_Then_returns_null() { MockServiceRepository.GetServiceMockById(Any.String()) .Should().BeNull("Because no MockService is registered at this port"); }