/// <summary> /// Initializes a new instance of the <see cref="ContactManager"/> class. /// </summary> /// <param name="logger"> /// The logger. /// </param> /// <param name="contactPersistence"> /// The contact persistence. /// </param> public ContactManager(ILogger logger, IContactPersistence contactPersistence) { Contract.Requires(logger != null); Contract.Requires(contactPersistence != null); Contract.Ensures(this.logger == logger); Contract.Ensures(this.contactPersistence == contactPersistence); this.logger = logger; this.contactPersistence = contactPersistence; }
/// <summary> /// Initializes a new instance of the <see cref="ContactManager"/> class. /// </summary> /// <param name="logger"> /// The logger. /// </param> /// <param name="contactPersistence"> /// The contact persistence. /// </param> /// <exception cref="ArgumentNullException"> /// </exception> /// <exception cref="ArgumentNullException"> /// </exception> public ContactManager(ILogger logger, IContactPersistence contactPersistence) { this.logger = logger; if (logger == null) { throw new ArgumentNullException("logger"); } this.contactPersistence = contactPersistence; if (contactPersistence == null) { throw new ArgumentNullException("contactPersistence"); } }
public static ContactManager Create( ILogger logger_iLogger, IContactPersistence contactPersistence_iContactPersistence ) { ContactManager contactManager = PexInvariant.CreateInstance<ContactManager>(); PexInvariant.SetField(contactManager, "logger", logger_iLogger); PexInvariant.SetField( contactManager, "contactPersistence", contactPersistence_iContactPersistence); PexInvariant.CheckInvariant(contactManager); return contactManager; // TODO: Edit factory method of ContactManager // This method should be able to configure the object in all possible ways. // Add as many parameters as needed, // and assign their values to each field by using the API. }
/// <summary> /// Initializes a new instance of the <see cref="ContactManager" /> class. /// </summary> /// <exception cref="ArgumentNullException"></exception> /// <exception cref="ArgumentNullException"></exception> public ContactManager() { this.logger = new Logger(new TextFileLoggingSink()); this.contactPersistence = new DummyExampleContactPersistence(this.logger); }
public ContactManager Constructor(ILogger logger, IContactPersistence contactPersistence) { ContactManager target = new ContactManager(logger, contactPersistence); return target; // TODO: add assertions to method ContactManagerTest.Constructor(ILogger, IContactPersistence) }