示例#1
0
 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.");
     }
 }
示例#2
0
        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);
        }
示例#3
0
        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");
        }
示例#4
0
        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.");
        }
示例#5
0
 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");
 }