public void Contains_returns_false_for_type_and_name_when_path_does_not_contain_any_matching_types(IServiceRegistration registration, string name) { // Arrange Mock.Get(registration).SetupGet(x => x.ServiceType).Returns(typeof(string)); var sut = new ResolutionPath(registration); // Act var result = sut.Contains(typeof(int), name); // Assert Assert.That(result, Is.False); }
public void Contains_returns_true_for_type_and_name_when_request_has_no_name(IServiceRegistration registration, string name) { // Arrange Mock.Get(registration).SetupGet(x => x.ServiceType).Returns(typeof(string)); Mock.Get(registration).SetupGet(x => x.Name).Returns(name); var sut = new ResolutionPath(registration); // Act var result = sut.Contains(typeof(string)); // Assert Assert.That(result, Is.True); }
public void Contains_returns_false_for_type_and_name_when_registration_in_path_has_different_name(IServiceRegistration registration, string name, string otherName) { // Arrange Mock.Get(registration).SetupGet(x => x.ServiceType).Returns(typeof(string)); Mock.Get(registration).SetupGet(x => x.Name).Returns(name); var sut = new ResolutionPath(registration); // Act var result = sut.Contains(typeof(string), otherName); // Assert Assert.That(result, Is.False); }
public void Contains_returns_true_for_registration_when_registration_in_path_matches(IServiceRegistration registration1, IServiceRegistration registration2, string name) { // Arrange Mock.Get(registration1).SetupGet(x => x.ServiceType).Returns(typeof(string)); Mock.Get(registration1).SetupGet(x => x.Name).Returns(name); Mock.Get(registration2).SetupGet(x => x.ServiceType).Returns(typeof(string)); Mock.Get(registration2).SetupGet(x => x.Name).Returns(name); var sut = new ResolutionPath(registration1); // Act var result = sut.Contains(registration2); // Assert Assert.That(result, Is.True); }
public void Contains_returns_false_for_typed_registration_when_impl_types_differ(TypedRegistration registration1, TypedRegistration registration2, string name) { // Arrange Mock.Get(registration1).SetupGet(x => x.ServiceType).Returns(typeof(string)); Mock.Get(registration1).SetupGet(x => x.ImplementationType).Returns(typeof(string)); Mock.Get(registration1).SetupGet(x => x.Name).Returns(name); Mock.Get(registration2).SetupGet(x => x.ServiceType).Returns(typeof(string)); Mock.Get(registration2).SetupGet(x => x.ImplementationType).Returns(typeof(int)); Mock.Get(registration2).SetupGet(x => x.Name).Returns(name); var sut = new ResolutionPath(registration1); // Act var result = sut.Contains(registration2); // Assert Assert.That(result, Is.False); }