public void CreateProperty_Accessors_ThrowsIfAlreadyExists() { var returnType = ReflectionObjectMother.GetSomeType(); var getMethod = MutableMethodInfoObjectMother.Create(declaringType: _mutableType, returnType: returnType); var property = _mutableType.AddProperty2("Property", getMethod: getMethod); Assert.That(() => _factory.CreateProperty(_mutableType, "OtherName", 0, getMethod, null), Throws.Nothing); var differentPropertyType = ReflectionObjectMother.GetSomeOtherType(); var getMethod2 = MutableMethodInfoObjectMother.Create(declaringType: _mutableType, returnType: differentPropertyType); Assert.That(() => _factory.CreateProperty(_mutableType, property.Name, 0, getMethod2, null), Throws.Nothing); var differentIndexParameters = ParameterDeclarationObjectMother.CreateMultiple(2); var getMethod3 = MutableMethodInfoObjectMother.Create(declaringType: _mutableType, returnType: returnType, parameters: differentIndexParameters); Assert.That(() => _factory.CreateProperty(_mutableType, property.Name, 0, getMethod3, null), Throws.Nothing); Assert.That( () => _factory.CreateProperty(_mutableType, property.Name, 0, getMethod, null), Throws.InvalidOperationException.With.Message.EqualTo("Property with equal name and signature already exists.")); }