public void ExistWitTheSameEmail() { var testFixture = new QueryTestFixture(); var dbContext = testFixture.Context; var mockFactory = new MockRepository(MockBehavior.Loose); dbContext.Add(new Account() { Email = "*****@*****.**" }); dbContext.SaveChanges(); var mediator = mockFactory.Create <IMediator>(); var ct = new CancellationToken(); var hashService = mockFactory.Create <IHashService>(); var cmd = new CreateAccountCommandHandler(mediator.Object, dbContext, hashService.Object); var cmdArgs = new CreateAccountCommand() { Alias = "alias", Email = "*****@*****.**", Password = "******" }; Assert.ThrowsAsync <UnableCreateAccountException>(async() => await cmd.Handle(cmdArgs, ct)); }
public UpdateCustomerHandlerTest(QueryTestFixture fixture) { _unitOfWork = fixture.UnitOfWork; _bus = fixture.Bus; _notifications = fixture.Notifications; _validator = new UpdateCustomerCommandValidator(); }
public GetPictureDetailsQueryHandlerTests(QueryTestFixture fixture) { this.context = fixture.Context; this.mapper = fixture.Mapper; this.handler = new GetPictureDetailsQueryHandler(this.context, this.mapper); }
public GetSurveyListQueryHandlerTests(QueryTestFixture fixture) { _context = fixture.Context; _mapper = fixture.Mapper; fixture.MockUserInformation.Setup(x => x.GetUser()).Returns(Task.FromResult("Test")); _getUserInformation = fixture.MockUserInformation.Object; }
public GetAddressesQueryHandlerFixture(QueryTestFixture fixture) { Context = fixture.Context; CurrentUser = new Domain.Entities.User { Id = Guid.NewGuid() }; Context.User.Add(CurrentUser); Addresses = new List <Domain.Entities.Address> { new Domain.Entities.Address { UserId = CurrentUser.Id }, new Domain.Entities.Address { UserId = CurrentUser.Id }, new Domain.Entities.Address { UserId = Guid.NewGuid() }, }; Context.Address.AddRange(Addresses); Context.SaveChanges(); }
public GetCategoryListQueryHandlerTest(QueryTestFixture fixture, ICouchBaseRepository <CategoryListViewModel> couchBaseRepository) { _context = fixture.Context; _mapper = fixture.Mapper; _couchBaseRepository = couchBaseRepository; }
public void Success() { var testFixture = new QueryTestFixture(); var mockFactory = new MockRepository(MockBehavior.Loose); var mediator = mockFactory.Create <IMediator>(); mediator.Setup(s => s.Publish(It.IsAny <CreatedAccountDomainEvent>(), It.IsAny <CancellationToken>())) .Returns(Task.Run(() => { })); var ct = new CancellationToken(); var hashService = mockFactory.Create <IHashService>(); var cmd = new CreateAccountCommandHandler(mediator.Object, testFixture.Context, hashService.Object); var cmdArgs = new CreateAccountCommand() { Alias = "alias", Email = "*****@*****.**", Password = "******" }; Assert.DoesNotThrowAsync(async() => await cmd.Handle(cmdArgs, ct)); }
public CreateChannelCommandHandlerTests(QueryTestFixture fixture) { _context = fixture.Context; _mapper = fixture.Mapper; // Login user _currentUserServiceMock.Setup(m => m.UserId) .Returns(userId1.ToString()); }
public AirportSearchQueryHandlerTest(QueryTestFixture fixture) { _context = fixture.Context; var myProfile = new AutoMapperProfile(); var configuration = new MapperConfiguration(cfg => cfg.AddProfile(myProfile)); _mapper = new Mapper(configuration); }
public void test_connect_with_bogus_authkey_and_username() { Action act = () => QueryTestFixture.DefaultConnectionBuilder() .User(bogusUsername, bogusPassword).AuthKey("test") .Connect(); act.ShouldThrow <ReqlDriverError>(); }
public GetLastContentOfConversationQueryHandlerTests(QueryTestFixture fixture) { _context = fixture.Context; _mapper = fixture.Mapper; //// Login user _currentUserServiceMock.Setup(m => m.UserId) .Returns(userId1.ToString()); }
public void AfterRunningTestSession() { var adminConn = QueryTestFixture.DefaultConnectionBuilder() .Connect(); R.Db("rethinkdb").Table("users").Get(bogusUsername) .Delete().RunResult(adminConn); adminConn.Close(); }
public GetConversationsByTeamIdQueryHandlerTests(QueryTestFixture fixture) { _context = fixture.Context; _mapper = fixture.Mapper; // Login user _currentUserServiceMock.Setup(m => m.UserId) .Returns(userId1.ToString()); // handler _sut = new GetConversationsByTeamIdQueryHandler(_context, _mapper); }
public EncrptionServiceTests(QueryTestFixture fixture) { _sut = new Mock <EncryptionService>().Object; _merchantService = new MerchantService( _merchantRepository, fixture.EncryptionService, fixture.AppSettings, fixture.Mapper); }
public ListAllUsersQueryHandlerTests(QueryTestFixture fixture) { this.context = fixture.Context; this.mapper = fixture.Mapper; this.mockedUserManager = IdentityMocker.GetMockedUserManager(); this.userManagerService = new UserManagerService( this.mockedUserManager.Object, IdentityMocker.GetMockedRoleManager().Object, this.context); }
public AuthHandlersTest(QueryTestFixture fixture) { optionsInstance = new JwtOptions() { Issuer = "parkbee.com", SecurityKey = "superUberDuperSecret" }; options = Options.Create(optionsInstance); _context = fixture.Context; userRepository = new UserRepository(_context); authenticationService = new AuthenticationService(options); }
public void BeforeRunningTestSession() { var adminConn = QueryTestFixture.DefaultConnectionBuilder() .Connect(); R.Db("rethinkdb").Table("users").Insert( new { id = bogusUsername, password = bogusPassword } ).Run(adminConn); adminConn.Close(); }
public void test_connect_with_non_admin_user() { var bogusConn = QueryTestFixture.DefaultConnectionBuilder() .User(bogusUsername, bogusPassword) .Connect(); R.Expr("HELLO FROM THE C# DRIVER! :D YEE HAAAW! HELLO FROM THE C# DRIVER! :D YEE HAAAW!" + " HELLO FROM THE C# DRIVER! :D YEE HAAAW! HELLO FROM THE C# DRIVER! :D YEE HAAAW! ") .Run(bogusConn); bogusConn.Close(); }
public AuthenticateUserCommandTests(QueryTestFixture fixture) { _merchantRepository = new Repository <Merchant>(_context); _merchantService = new MerchantService( _merchantRepository, fixture.EncryptionService, fixture.AppSettings, fixture.Mapper); _sut = new AuthenticateUserCommandHandler(_merchantService); _sutValidator = new AuthenticateUserCommandValidator(); }
public CompleteOrderTestFixtures(QueryTestFixture fixture) { Context = fixture.Context; Order = new Domain.Entities.Order() { Id = Guid.NewGuid(), AcceptedByUserId = Guid.NewGuid(), Complete = false }; Context.Order.Add(Order); Context.SaveChanges(); }
public ListItemsQueryHandlerTests(QueryTestFixture fixture) { this.context = fixture.Context; this.mapper = fixture.Mapper; var mockedDatetime = new Mock <IDateTime>(); mockedDatetime.Setup(x => x.UtcNow).Returns(DateTime.UtcNow); mockedDatetime.Setup(x => x.Now).Returns(DateTime.Now); this.dateTime = mockedDatetime.Object; this.handler = new ListItemsQueryHandler(this.context, this.dateTime, this.mapper); }
public EmployeesTest(QueryTestFixture fixture) { _context = fixture.Context; _mapper = fixture.Mapper; _context.Employees.Add(new domain.Employee { FirstName = "Janinejams", LastName = "Shaunerin", CompanyEmail = "*****@*****.**", PersonalEmail = "*****@*****.**", EmployeeNumber = "13124", ID = Guid.Parse("96863F02-CE07-40FC-A2ED-A7FAFB36FEAD"), }); _context.SaveChanges(); }
public AcceptOrderTestsFixture(QueryTestFixture fixture) { Context = fixture.Context; AcceptedOrder = new Domain.Entities.Order() { Id = Guid.NewGuid(), AcceptedByUserId = Guid.NewGuid() }; PendingOrder = new Domain.Entities.Order() { Id = Guid.NewGuid(), }; Context.Order.Add(AcceptedOrder); Context.Order.Add(PendingOrder); Context.SaveChanges(); }
public GetAddressQueryHandlerFixture(QueryTestFixture fixture) { Context = fixture.Context; ValidAddressId = Guid.NewGuid(); Addresses = new List <Domain.Entities.Address> { new Domain.Entities.Address { Id = ValidAddressId }, new Domain.Entities.Address { Id = Guid.NewGuid() }, new Domain.Entities.Address { Id = Guid.NewGuid() } }; Context.Address.AddRange(Addresses); Context.SaveChanges(); }
public GetCurrentOrdersFixture(QueryTestFixture fixture) { Context = fixture.Context; CurrentUser = new Domain.Entities.User { Id = Guid.NewGuid() }; Context.User.Add(CurrentUser); Orders = new List <Domain.Entities.Order> { new Domain.Entities.Order { Id = Guid.NewGuid(), Complete = false, AcceptedByUser = CurrentUser }, new Domain.Entities.Order { Id = Guid.NewGuid(), Complete = false, AcceptedByUser = CurrentUser }, new Domain.Entities.Order { Id = Guid.NewGuid(), Complete = true } }; Context.Order.AddRange(Orders); Context.SaveChanges(); }
public GetTodosQueryTests(QueryTestFixture fixture) { _context = fixture.Context; _mapper = fixture.Mapper; }
public GetUsuarioDetailQueryHandlerTests(QueryTestFixture fixture) { _context = fixture.Context; }
public GetContactDetailQueryHandlerTests(QueryTestFixture fixture) { _context = fixture.Context; }
public GetSiteBriefsListQueryTests(QueryTestFixture fixture) { _context = fixture.Context; _mapper = fixture.Mapper; }
public GetEventSeriesDetailQueryHandlerTests(QueryTestFixture fixture) { _context = fixture.Context; _mapper = fixture.Mapper; }