public override void Given()
 {
     base.Given();
     this.Subject     = new DistributorService(this.MockedSmsService, this.MockedMailService, this.MockedMailFactory);
     this.Badge       = new List <Badge>(DomainStubFactory.CreateOwner().Badges)[0];
     this.Declaration = DomainStubFactory.CreateDeclaration(Badge);
 }
示例#2
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);
        }
示例#3
0
 public override void Given()
 {
     base.Given();
     this.BadgeToBeActivated = new Badge {
         Nbr = "333333333"
     };
     Owner   = DomainStubFactory.CreateOwner();
     Subject = new ActivateController(this.ApplicationFacade);
     MockedSessionService.Stub(x => x["badgeNbr"]).Return(new List <Badge>(Owner.Badges)[0].Nbr);
     MockedSessionService.Stub(x => x["owner"]).Return(Owner);
     MockedBadgeRepository.Stub(x => x.GetBy(n => n.Nbr == new List <Badge>(Owner.Badges)[0].Nbr)).IgnoreArguments().Return(this.BadgeToBeActivated);
     MockedMapperService.Stub(x => x.MapToOwner(Owner, new ActivateMobileRequest())).IgnoreArguments().Return(Owner);
     MockedDistributorService.Stub(x => x.SendActivationConfirmation(this.BadgeToBeActivated));
 }
示例#4
0
        public override void Given()
        {
            base.Given();
            Subject  = new ActivateController(this.ApplicationFacade);
            _request = new ActivateIndexRequest
            {
                Gender = Gender.Male,
                Email  = "*****@*****.**",
                Email2 = "*****@*****.**",
                //todo:remove magic const
                ConfirmEmail    = "*****@*****.**",
                Password        = "******",
                ConfirmPassword = "******",
            };
            _owner = DomainStubFactory.CreateOwner();
            MockedMapperService.Stub(n => n.MapToOwner(_owner, _request)).Return(_owner).IgnoreArguments();
            MockedSessionService.Stub(n => n["badgeNbr"]).Return(new List <Badge>(DomainStubFactory.CreateOwner().Badges)[0].Nbr);
            string salt;

            MockedSecurityService.Stub(n => n.Hash(_request.Password, out salt)).Return("hasedPassword").OutRef("theSalt");
        }