public void CustomFactoryNongenericMethod() { var factory = new CustomFactory(_comparerB); var comparer = factory.GetObjectsComparer(typeof(B)); var b1 = new B(); var b2 = new B(); _comparerB.CalculateDifferences(b1, b2).Returns(new List <Difference>()); var isEqual = comparer.Compare(typeof(B), b1, b2); Assert.IsTrue(isEqual); _comparerB.Received().CalculateDifferences(b1, b2); }