public AuthenticationService() { _Profile = new ProfileDao(); _Hash = new Sha256Adapter(); _OtpService = new OtpService(); _Notification = new SlackAdapter(); _FailedCounter = new FailedCounter(); _Logger = new NLogAdapter(); }
public AuthenticationService() { _profile = new ProfileDao(); _hash = new Sha256Adapter(); _otpService = new OtpService(); _notification = new SlackAdapter(); _failedCounter = new FailedCounter(); _logger = new NLogAdapter(); }
//alt + insert public AuthenticationService(IProfile profile, IHash hash, IOtp otpService, INotification notification, IFailedCounter failedCounter, ILogger logger) { _Profile = profile; _Hash = hash; _OtpService = otpService; _Notification = notification; _FailedCounter = failedCounter; _Logger = logger; }
public AuthenticationService(IProfileDao profileDao, IFailedCounter failedCounter, ISlackAdapter slackAdapter, ISha256Adapter sha256Adapter, IOtpService otpService, ILogger logger) { _profileDao = profileDao; _failedCounter = failedCounter; _slackAdapter = slackAdapter; _sha256Adapter = sha256Adapter; _otpService = otpService; _logger = logger; }
public AuthenticationService(IFailedCounter failedCounter, ILogger logger, IOtpService otpService, IProfile profile, IHash hash, INotification notification) { _profile = profile; _hash = hash; _otpService = otpService; _notification = notification; _failedCounter = failedCounter; _logger = logger; }
public void Setup() { _profile = Substitute.For <IProfile>(); _hash = Substitute.For <IHash>(); _otpService = Substitute.For <IOtpService>(); _notification = Substitute.For <INotification>(); _failedCounter = Substitute.For <IFailedCounter>(); _logger = Substitute.For <ILogger>(); _authenticationService = new AuthenticationService(_profile, _hash, _otpService, _notification, _failedCounter, _logger); }
public void Setup() { _ProfileDao = Substitute.For <IProfile>(); _Otp = Substitute.For <IOtp>(); _Hash = Substitute.For <IHash>(); _FailCounter = Substitute.For <IFailedCounter>(); _Notification = Substitute.For <INotification>(); _Logger = Substitute.For <ILogger>(); _AuthenticationService = new AuthenticationService(_ProfileDao, _Hash, _Otp, _Notification, _FailCounter, _Logger); _AuthenticationService = new FailedCounterDecorator(_AuthenticationService, _FailCounter); _AuthenticationService = new LogFailedCounterDecorator(_AuthenticationService, _Logger, _FailCounter); _AuthenticationService = new NotificationDecorator(_AuthenticationService, _Notification); }
public void SetUp() { _profile = Substitute.For <IProfile>(); _otpService = Substitute.For <IOtp>(); _notification = Substitute.For <INotification>(); _failedCounter = Substitute.For <IFailedCounter>(); _logger = Substitute.For <ILogger>(); _hash = Substitute.For <IHash>(); var authenticationService = new AuthenticationService(_profile, _hash, _otpService); var failedCounterDecorator = new FailedCounterDecorator(authenticationService, _failedCounter); var logDecorator = new LogDecorate(failedCounterDecorator, _failedCounter, _logger); _authenticationService = new NotifyDecorator(logDecorator, _notification); }
public void SetUp() { _notification = Substitute.For <INotification>(); _logger = Substitute.For <ILogger>(); _failedCounter = Substitute.For <IFailedCounter>(); _otpService = Substitute.For <IOtpService>(); _hash = Substitute.For <IHash>(); _profile = Substitute.For <IProfile>(); _authentication = new AuthenticationService(_profile, _hash, _otpService); _authentication = new NotificationDecorator(_authentication, _notification); _authentication = new FailedCounterDecorator(_authentication, _failedCounter); _authentication = new LogFailedCountDecorator(_authentication, _failedCounter, _logger); }
public void Setup() { _profile = Substitute.For <IProfile>(); _hash = Substitute.For <IHash>(); _otpService = Substitute.For <IOTPService>(); _failedCounter = Substitute.For <IFailedCounter>(); _logger = Substitute.For <ILogger>(); _notification = Substitute.For <INotification>(); var authenticationService = new AuthenticationService( _hash, _otpService, _profile); var notificationDecorator = new NotificationDecorator(authenticationService, _notification); var failedCounterDecorator = new FailedCounterDecorator(notificationDecorator, _failedCounter); _authentication = new LogFailedCountDecorator(failedCounterDecorator, _failedCounter, _logger); }
public void Setup() { //Use NSubstitute to mock objects. _profile = Substitute.For <IProfile>(); _otpRemoteProxy = Substitute.For <IOtp>(); _hash = Substitute.For <IHash>(); _notification = Substitute.For <INotification>(); _failedCounter = Substitute.For <IFailedCounter>(); _logger = Substitute.For <ILogger>(); var authenticationService = new AuthenticationService(_profile, _hash, _otpRemoteProxy); var notificationDecorator = new NotificationDecorator(authenticationService, _notification); var logDecorator = new FailedCounterDecorator(notificationDecorator, _failedCounter); _authentication = new LogDecorator(logDecorator, _failedCounter, _logger); }
public void Setup() { _profileRepo = Substitute.For <IProfileRepo>(); _hashedAdapter = Substitute.For <IHashedAdapter>(); _otpService = Substitute.For <IOtpService>(); _logAdapter = Substitute.For <ILogAdapter>(); _notifyAdapter = Substitute.For <INotifyAdapter>(); _failedCounter = Substitute.For <IFailedCounter>(); _authenticationService = new AuthenticationService(_profileRepo, _hashedAdapter, _otpService, _notifyAdapter); var failedCounterDecorator = new FailedCounterDecorator(_authenticationService, _failedCounter); var logDecorator = new LogDecorator(failedCounterDecorator, _logAdapter, _failedCounter); _authenticationService = logDecorator; }
public void Setup() { _logger = Substitute.For <ILogger>(); _profile = Substitute.For <IProfile>(); _optService = Substitute.For <IOtp>(); _hash = Substitute.For <IHash>(); _notification = Substitute.For <INotification>(); _failedCounter = Substitute.For <IFailedCounter>(); _apiCountQuota = Substitute.For <IApiCountQuota>(); var authenticationService = new AuthenticationService(_profile, _hash, _optService); var notificationDecorator = new NotificationDecorator(authenticationService, _notification); var failedCountDecorator = new FailedCountDecorator(notificationDecorator, _failedCounter); var logDecorator = new LogDecorator(failedCountDecorator, _logger, _failedCounter); var apiCallQuotaDecorator = new ApiCallQuotaDecorator(logDecorator, _apiCountQuota); _authentication = apiCallQuotaDecorator; }
public void SetUp() { _profile = Substitute.For <IProfile>(); _hash = Substitute.For <IHash>(); _otpService = Substitute.For <IOtpService>(); _failedCounter = Substitute.For <IFailedCounter>(); _notification = Substitute.For <INotification>(); _logger = Substitute.For <ILogger>(); //先初始化一個最基本的Service var authentication = new AuthenticationService(_profile, _hash, _otpService); //然後裝飾他,越後面越先執行 var notificationDecorator = new NotificationDecorator(authentication, _notification); var failedCounterDecorator = new FailedCounterDecorator(notificationDecorator, _failedCounter); _authentication = new LogFailedCountDecorator(failedCounterDecorator, _failedCounter, _logger); }
public void SetUp() { _profile = Substitute.For <IProfile>(); _otp = Substitute.For <IOtp>(); _hash = Substitute.For <IHash>(); _notification = Substitute.For <INotification>(); _logger = Substitute.For <ILogger>(); _failedCounter = Substitute.For <IFailedCounter>(); _apiUserQuotaV2 = Substitute.For <IApiUserQuotaV2>(); var authenticationService = new AuthenticationService(_profile, _hash, _otp); var checkUseTimeDecorator = new ApiCheckTimeDecorator(authenticationService, _apiUserQuotaV2); var notificationDecorator = new NotificationDecorator(checkUseTimeDecorator, _notification, _logger); var failedCounterDecorator = new FailedCounterDecorator(notificationDecorator, _failedCounter); var logDecorator = new LogDecorator(failedCounterDecorator, _failedCounter, _logger); _authentication = logDecorator; }
static void Main(string[] args) { RegisterContainer(); _logger = new FakeLogger(); _failedCounter = new FakeFailedCounter(); _notification = new FakeSlack(); _otpService = new FakeOtp(); _hash = new FakeHash(); _profile = new FakeProfile(); _authenticationService = new AuthenticationService(_profile, _hash, _otpService, _notification, _failedCounter, _logger); //_authenticationService = new FailedCounterDecorator(_authenticationService, _failedCounter); //_authenticationService = new LogFailedCounterDecorator(_authenticationService, _logger, _failedCounter); //_authenticationService = new NotificationDecorator(_authenticationService, _notification); var isValid = _authenticationService.Verify("joey", "abc", "wrong otp"); Console.WriteLine($"result is {isValid}"); }
public void SetUp() { _profile = Substitute.For <IProfile>(); _hash = Substitute.For <IHash>(); _otpService = Substitute.For <IOtpService>(); _failedCounter = Substitute.For <IFailedCounter>(); _notification = Substitute.For <INotification>(); _logger = Substitute.For <ILogger>(); // 主體 var authenticationService = new AuthenticationService( _profile, _hash, _otpService); // 主體(_authentication)以界面作接口 // authenticationService 配上 Notification => notificationDecorator var notificationDecorator = new NotificationDecorator(authenticationService, _notification); // notificationDecorator 配上 FailedCounterDecorator => failedCounterDecorator var failedCounterDecorator = new FailedCounterDecorator(notificationDecorator, _failedCounter); // failedCounterDecorator 配上 LogFaileCounterDecorator => _authentication _authentication = new LogFaileCounterDecorator(failedCounterDecorator, _failedCounter, _logger); }
public LogDecorator(IAuthentication authentication, IFailedCounter failedCounter, ILogger logger) : base(authentication) { _failedCounter = failedCounter; _logger = logger; }
public LogFailedCountDecorator(IAuthentication authenticationService, IFailedCounter failedCounter, ILogger logger) : base(authenticationService) { _failedCounter = failedCounter; _logger = logger; }
public FailedCounterDecorator(IAuthentication authentication, IFailedCounter failedCounter) : base(authentication) { _failedCounter = failedCounter; }
public FailedCountDecorator(IAuthentication authenticationService, IFailedCounter failedCounter) : base(authenticationService) { _failedCounter = failedCounter; }
public FailedCounterDecorator(IAuthenticationService authenticationService, IFailedCounter failedCounter) { _authenticationService = authenticationService; _failedCounter = failedCounter; }
public LogDecorator(IAuthenticationService authenticationService, ILogger logger, IFailedCounter failedCounter) { _authenticationService = authenticationService; _logger = logger; _failedCounter = failedCounter; }