public BaseContactValidatorTests(ITestOutputHelper output)
        {
            var logger = output.CreateLoggerFactory().CreateLogger <ContactValidatorDummy>();

            CountryNameValidator = new CountryNameValidatorStub();
            Validator            = new ContactValidatorDummy(CountryNameValidator, logger);
        }
コード例 #2
0
        public DeleteContactsControllerTests(ITestOutputHelper output) : base("api/contacts/delete")
        {
            var loggerFactory = output.CreateLoggerFactory();

            Session        = new DeleteContactSessionMock();
            SessionFactory = new FactorySpy <DeleteContactSessionMock>(Session);
            Controller     = new DeleteContactController(SessionFactory.GetInstance, loggerFactory.CreateLogger <DeleteContactController>());
        }
        public UpdateContactControllerTests(ITestOutputHelper output) : base("api/contacts/update")
        {
            var loggerFactory = output.CreateLoggerFactory();
            var validator     = new ContactValidator(new CountryNameValidatorStub(), loggerFactory.CreateLogger <ContactValidator>());

            Session        = new UpdateContactSessionMock();
            SessionFactory = new FactorySpy <UpdateContactSessionMock>(Session);
            Controller     = new UpdateContactController(validator, SessionFactory.GetInstance, loggerFactory.CreateLogger <UpdateContactController>());
        }
        public NewContactControllerTests(ITestOutputHelper output) : base("api/contacts/new")
        {
            CountryNameValidator = new CountryNameValidatorStub();
            var loggerFactory = output.CreateLoggerFactory();
            var validator     = new NewContactDtoValidator(CountryNameValidator, loggerFactory.CreateLogger <NewContactDtoValidator>());

            Session        = new NewContactSessionMock();
            SessionFactory = new FactorySpy <NewContactSessionMock>(Session);
            Mapper         = new Mapper(new MapperConfiguration(expression => expression.AddProfile(new NewContactAutoMapperProfile())));
            Controller     = new NewContactController(validator, SessionFactory.GetInstance, Mapper, loggerFactory.CreateLogger <NewContactController>());
        }
コード例 #5
0
ファイル: TestHelper.cs プロジェクト: vip32/Naos
        public static ILoggerFactory CreateLoggerFactory(ITestOutputHelper output, LoggingSettings settings = null)
        {
            EnsureArg.IsNotNull(output, nameof(output));

            return(output.CreateLoggerFactory(settings));
        }
コード例 #6
0
        public ContactValidatorTests(ITestOutputHelper output)
        {
            var logger = output.CreateLoggerFactory().CreateLogger <ContactValidator>();

            Validator = new ContactValidator(new CountryNameValidatorStub(), logger);
        }
コード例 #7
0
        public static ILogger <T> CreateLogger <T>(this ITestOutputHelper output)
        {
            var factory = output.CreateLoggerFactory();

            return(factory.CreateLogger <T>());
        }