protected void Page_Load(object sender, EventArgs e)
        {
            var user = IdentificationService.GetCurrentUser();

            lblUserName.Text = String.Format("{0} {1}", user.Nom, user.Prenom);
            lblUserType.Text = user.UserType.NameStr;
        }
Esempio n. 2
0
        public void SetUp()
        {
            UseRealHttp();

            // Resolve all the parts we need
            Mocker.SetConstant <IArtistRepository>(Mocker.Resolve <ArtistRepository>());
            Mocker.SetConstant <IArtistMetadataRepository>(Mocker.Resolve <ArtistMetadataRepository>());
            Mocker.SetConstant <IAlbumRepository>(Mocker.Resolve <AlbumRepository>());
            Mocker.SetConstant <IReleaseRepository>(Mocker.Resolve <ReleaseRepository>());
            Mocker.SetConstant <ITrackRepository>(Mocker.Resolve <TrackRepository>());
            Mocker.SetConstant <IImportListExclusionRepository>(Mocker.Resolve <ImportListExclusionRepository>());
            Mocker.SetConstant <IMediaFileRepository>(Mocker.Resolve <MediaFileRepository>());

            Mocker.GetMock <IMetadataProfileService>().Setup(x => x.Exists(It.IsAny <int>())).Returns(true);

            _artistService = Mocker.Resolve <ArtistService>();
            Mocker.SetConstant <IArtistService>(_artistService);
            Mocker.SetConstant <IArtistMetadataService>(Mocker.Resolve <ArtistMetadataService>());
            Mocker.SetConstant <IAlbumService>(Mocker.Resolve <AlbumService>());
            Mocker.SetConstant <IReleaseService>(Mocker.Resolve <ReleaseService>());
            Mocker.SetConstant <ITrackService>(Mocker.Resolve <TrackService>());
            Mocker.SetConstant <IImportListExclusionService>(Mocker.Resolve <ImportListExclusionService>());
            Mocker.SetConstant <IMediaFileService>(Mocker.Resolve <MediaFileService>());

            Mocker.SetConstant <IConfigService>(Mocker.Resolve <IConfigService>());
            Mocker.SetConstant <IProvideArtistInfo>(Mocker.Resolve <SkyHookProxy>());
            Mocker.SetConstant <IProvideAlbumInfo>(Mocker.Resolve <SkyHookProxy>());

            _addArtistService = Mocker.Resolve <AddArtistService>();

            Mocker.SetConstant <IRefreshTrackService>(Mocker.Resolve <RefreshTrackService>());
            Mocker.SetConstant <IRefreshAlbumReleaseService>(Mocker.Resolve <RefreshAlbumReleaseService>());
            Mocker.SetConstant <IRefreshAlbumService>(Mocker.Resolve <RefreshAlbumService>());
            _refreshArtistService = Mocker.Resolve <RefreshArtistService>();

            Mocker.GetMock <IAddArtistValidator>().Setup(x => x.Validate(It.IsAny <Artist>())).Returns(new ValidationResult());

            Mocker.SetConstant <ITrackGroupingService>(Mocker.Resolve <TrackGroupingService>());
            Mocker.SetConstant <ICandidateService>(Mocker.Resolve <CandidateService>());

            // set up the augmenters
            List <IAggregate <LocalAlbumRelease> > aggregators = new List <IAggregate <LocalAlbumRelease> >
            {
                Mocker.Resolve <AggregateFilenameInfo>()
            };

            Mocker.SetConstant <IEnumerable <IAggregate <LocalAlbumRelease> > >(aggregators);
            Mocker.SetConstant <IAugmentingService>(Mocker.Resolve <AugmentingService>());

            _Subject = Mocker.Resolve <IdentificationService>();
        }
Esempio n. 3
0
 /// <summary>
 ///     Returns a hash code for this instance.
 /// </summary>
 /// <returns>
 ///     A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
 /// </returns>
 public override int GetHashCode()
 {
     unchecked
     {
         int result = (IdentificationService != null ? IdentificationService.GetHashCode() : 0);
         result = (result * 397) ^ (BodyType != null ? BodyType.GetHashCode() : 0);
         result = (result * 397) ^ CreatedAt.GetHashCode();
         result = (result * 397) ^ EncodingCodePage;
         result = (result * 397) ^ ReinjectionNumber;
         result = (result * 397) ^ Priority;
         result = (result * 397) ^ Type.GetHashCode();
         return(result);
     }
 }
Esempio n. 4
0
        public void SetUp()
        {
            UseRealHttp();

            // Resolve all the parts we need
            Mocker.SetConstant <IAuthorRepository>(Mocker.Resolve <AuthorRepository>());
            Mocker.SetConstant <IAuthorMetadataRepository>(Mocker.Resolve <AuthorMetadataRepository>());
            Mocker.SetConstant <IBookRepository>(Mocker.Resolve <BookRepository>());
            Mocker.SetConstant <IImportListExclusionRepository>(Mocker.Resolve <ImportListExclusionRepository>());
            Mocker.SetConstant <IMediaFileRepository>(Mocker.Resolve <MediaFileRepository>());

            Mocker.GetMock <IMetadataProfileService>().Setup(x => x.Exists(It.IsAny <int>())).Returns(true);

            _authorService = Mocker.Resolve <AuthorService>();
            Mocker.SetConstant <IAuthorService>(_authorService);
            Mocker.SetConstant <IAuthorMetadataService>(Mocker.Resolve <AuthorMetadataService>());
            Mocker.SetConstant <IBookService>(Mocker.Resolve <BookService>());
            Mocker.SetConstant <IImportListExclusionService>(Mocker.Resolve <ImportListExclusionService>());
            Mocker.SetConstant <IMediaFileService>(Mocker.Resolve <MediaFileService>());

            Mocker.SetConstant <IConfigService>(Mocker.Resolve <IConfigService>());
            Mocker.SetConstant <IProvideAuthorInfo>(Mocker.Resolve <GoodreadsProxy>());
            Mocker.SetConstant <IProvideBookInfo>(Mocker.Resolve <GoodreadsProxy>());

            _addAuthorService = Mocker.Resolve <AddAuthorService>();

            Mocker.SetConstant <IRefreshBookService>(Mocker.Resolve <RefreshBookService>());
            _refreshAuthorService = Mocker.Resolve <RefreshAuthorService>();

            Mocker.GetMock <IAddAuthorValidator>().Setup(x => x.Validate(It.IsAny <Author>())).Returns(new ValidationResult());

            Mocker.SetConstant <ITrackGroupingService>(Mocker.Resolve <TrackGroupingService>());
            Mocker.SetConstant <ICandidateService>(Mocker.Resolve <CandidateService>());

            // set up the augmenters
            List <IAggregate <LocalEdition> > aggregators = new List <IAggregate <LocalEdition> >
            {
                Mocker.Resolve <AggregateFilenameInfo>()
            };

            Mocker.SetConstant <IEnumerable <IAggregate <LocalEdition> > >(aggregators);
            Mocker.SetConstant <IAugmentingService>(Mocker.Resolve <AugmentingService>());

            _Subject = Mocker.Resolve <IdentificationService>();
        }
Esempio n. 5
0
        /// <summary>
        /// 获取某人通过验证的身份认证标识
        /// </summary>
        /// <param name="htmlHelper"></param>
        /// <param name="userId">用户Id</param>
        /// <returns></returns>
        public static MvcHtmlString IdentificationType(this HtmlHelper htmlHelper, long userId)
        {
            if (userId <= 0)
            {
                throw new ArgumentException("参数名称userid不能为0", "userId");
            }
            //获取某人通过验证的身份认证
            IdentificationService identificationService = new IdentificationService();

            //List<Identification> identifications = identificationService.GetUserIdentifications(userId).Where(n=>n.Status==IdentificationStatus.success).ToList();
            ////获取可用的身份认证标识
            //IEnumerable<IdentificationType> identificationTypes =  identificationService.GetIdentificationTypes(true);
            ////获取这些身份验证的认证标识
            //htmlHelper.ViewData["identificationTypes"] = identificationTypes.Join(identifications, n => n.IdentificationTypeId, u => u.IdentificationTypeId, (n, u) => n).Distinct();

            htmlHelper.ViewData["identificationTypes"] = identificationService.GetIdentificationTypes(userId);

            return(htmlHelper.DisplayForModel("IdentificationType"));
        }
Esempio n. 6
0
        protected SessionBase(int userId, string userName, string password, int?sendAckResponseThershold, int?receivedBytesThershold, NegotiationSetting negotiationSetting = null, TimingSetting timingSetting = null)
        {
            if (string.IsNullOrEmpty(userName))
            {
                throw new ArgumentNullException("El nombre de usuario no puede ser una cadena vacía o nula.");
            }

            if (string.IsNullOrEmpty(password))
            {
                throw new ArgumentNullException("La contraseña de autenticación requerida no puede ser una cadena nula o vacía.");
            }

            _password = password;

            CommunicationTimeout   = DefaultCommunicationTimeout;
            AckResponseThreshold   = sendAckResponseThershold ?? DefaultSendAckResponseThreshold;
            ReceivedBytesThreshold = receivedBytesThershold;

            _serviceExecutionStopwatch = new Stopwatch();
            SessionStatus = SessionStatus.Closed;

            Phase          = SessionPhase.Idle;
            HandshakeState = HandshakeState.Identification;
            dataLinkPacket = new DataLinkPacket();

            Services = new List <IService>();
            identificationService = new IdentificationService();
            logonService          = new LogonService(userId, userName);

            if (negotiationSetting != null)
            {
                negotiateService = new NegotiateService(negotiationSetting);
            }
            if (timingSetting != null)
            {
                timingSetupService = new TimingSetupService(timingSetting);
            }
        }
Esempio n. 7
0
 public void Setup()
 {
     _identificationService = new IdentificationService();
 }
Esempio n. 8
0
 public void Initialize()
 {
     _identificationService = new IdentificationService();
 }