Пример #1
0
        public override void Given()
        {
            this.OwnerThatLogsIn = DomainStubFactory.CreateOwner();
            this.OwnerRepository = StructureMapMockRepository.RegisterMock <IRepository <Badge, string> >();
            this.OwnerRepository.Expect(x => x.GetBy(n => n.Nbr == OwnerThatLogsIn.Badges[0].Nbr)).IgnoreArguments()
            .Return(this.OwnerThatLogsIn.Badges[0]);
            this.SecurityServiceMocked = MockRepository.GenerateMock <ISecurityService>();
            this.Password = "******";

            this.SecurityServiceMocked.Expect(n => n.Hash(this.Password, this.OwnerThatLogsIn.PasswordSalt))
            .Return(this.OwnerThatLogsIn.PasswordHash);
            this.Subject = new AuthenticationService(this.OwnerRepository, this.SecurityServiceMocked);
        }
Пример #2
0
        public override void Given()
        {
            base.Given();
            this.StubResourceProvider = MockRepository.GenerateMock <IResourceProvider>();
            this.Resources            = DomainStubFactory.CreateResources();
            this.StubResourceProvider.Stub(n => n.GetResources()).Return(this.Resources);
            TenantContext.SetTenantContextProvider(new StubTenantContextProvider());
            TenantResources.SetTenantResourceProvider(this.StubResourceProvider);

            this.MockedBadgeRepository       = MockRepository.GenerateMock <IRepository <Badge, string> >();
            this.MockedDeclarationRepository = MockRepository.GenerateMock <IRepository <Declaration> >();
            this.MockedMapperService         = MockRepository.GenerateMock <IMapperService>();
            this.MockedSessionService        = MockRepository.GenerateMock <ISessionService>();
            this.MockedSecurityService       = MockRepository.GenerateMock <ISecurityService>();
            this.MockedDistributorService    = MockRepository.GenerateMock <IDistributorService>();
            this.MockedSmsService            = StructureMapMockRepository.RegisterMock <ISmsService>();
            this.MockedMailService           = StructureMapMockRepository.RegisterMock <IMailService>();
            this.MockedAutheticationService  = StructureMapMockRepository.RegisterMock <IAuthenticationService>();
            this.MockedMailFactory           = StructureMapMockRepository.RegisterMock <IMailFactory>();
            this.MockedOwnerRepository       = StructureMapMockRepository.RegisterMock <IRepository <Owner> >();

            this.ApplicationFacade = new ApplicationFacade(this.MockedSessionService, this.MockedDistributorService, this.MockedBadgeRepository, this.MockedDeclarationRepository, this.MockedSecurityService, this.MockedAutheticationService, this.MockedOwnerRepository, this.MockedMapperService);
        }