mardi 19 juillet 2022

C# method that determines if given object is a singleton instance

I need to complete the piece of code to write a method that takes a factory method that returns an object and determines if the object is a singleton instance.This is for an exercise of a course i am taking about design patterns. All the previous exercises were about implementing the pattern but this one is about testing and i dont have any idea how to test this

 public class SingletonTester
{
  public static bool IsSingleton(Func<object> func)
  {
    // todo        
  }
}

Aucun commentaire:

Enregistrer un commentaire