public async void GetAccountingUserByEmailOrUserNameWithEmailShouldReturnAnUser() { var runner = new TestRunner(services => services.Configure<IdentityOptions>(options => { options.Password.RequireUppercase = false; options.Password.RequireNonLetterOrDigit = false; options.Password.RequireDigit = false; })); string id = string.Empty; await runner.Setup(async (context, next) => { var userManager = context.ApplicationServices.GetService<UserManager<AccountingUser>>(); var user = new AccountingUser { UserName = TestUserNameOne, Email = TestUserEmailOne }; var result = await userManager.CreateAsync(user, TestPassword); if (result.Succeeded) { id = (await userManager.FindByNameAsync(TestUserNameOne)).Id; } }) .Test((context, next) => { var userRepo = context.ApplicationServices.GetService<AccountUserRepository>(); var user = userRepo.GetAccountingUserByEmailOrUserName(TestUserEmailOne); user.Should().NotBeNull(); user.Id.Should().BeEquivalentTo(id); return Task.FromResult(0); }) .Run(); }
public SessionResults RunAssembly(Assembly assembly) { var sessionResults = new SessionResults(); var logger = new GilesXunitLogger(); using (var exWrapper = new XunitFx.ExecutorWrapper(new Uri(assembly.CodeBase).LocalPath, null, false)) { var runner = new XunitFx.TestRunner(exWrapper, logger); var result = runner.RunAssembly(); } return logger.SessionResults; }
public SessionResults RunAssembly(Assembly assembly) { var sessionResults = new SessionResults(); var logger = new GilesXunitLogger(); using (var exWrapper = new XunitFx.ExecutorWrapper(new Uri(assembly.CodeBase).LocalPath, null, false)) { var runner = new XunitFx.TestRunner(exWrapper, logger); var result = runner.RunAssembly(); } return(logger.SessionResults); }
public void RunTests() { var logger = new ReSharperRunnerLogger(server, taskProvider); var runner = new Xunit.TestRunner(executor, logger); foreach (var className in taskProvider.ClassNames) { logger.ClassStart(className); runner.RunTests(className, taskProvider.GetMethodNames(className).ToList()); logger.ClassFinished(); } }
public SessionResults RunAssembly(Assembly assembly, IEnumerable<string> filters) { var logger = new GilesXunitLogger(); using (var exWrapper = new XunitFx.ExecutorWrapper(new Uri(assembly.CodeBase).LocalPath, null, false)) { var runner = new XunitFx.TestRunner(exWrapper, logger); if (filters.Count() == 0) runner.RunAssembly(); else filters.Each(x => runner.RunClass(x)); } return logger.SessionResults; }
public void can_run_tests() { var testConfiguration = new TestConfiguration(5, 10, 5, "BbcGetRequest", "PerformanceDsl.Tests.Tests"); var testRun = new TestRun { DllThatContainsTestsPath = "C:\\Agent\\Tests\\PerformanceDsl.Tests.dll", TestRunIdentifier = Guid.NewGuid() }; testRun.TestConfigurations.Add(testConfiguration); var testRunner = new TestRunner(); XmlConfigurator.Configure(); Task task = testRunner.Begin(testRun); task.ContinueWith(x => { Console.WriteLine(x.Status.ToString()); Console.WriteLine("end"); }); task.Wait(); }
public SessionResults RunAssembly(Assembly assembly, IEnumerable <string> filters) { var logger = new GilesXunitLogger(); using (var exWrapper = new XunitFx.ExecutorWrapper(new Uri(assembly.CodeBase).LocalPath, null, false)) { var runner = new XunitFx.TestRunner(exWrapper, logger); if (filters.Count() == 0) { runner.RunAssembly(); } else { filters.Each(x => runner.RunClass(x)); } } return(logger.SessionResults); }
public IEnumerable<AutoTest.TestRunners.Shared.Results.TestResult> Run(RunSettings settings) { var logger = new XUnitLogger(); XunitProject project = new XunitProject(); var runner = settings.Assembly; // Set assembly externally as XUnit screws up the casing logger.SetCurrentAssembly(runner.Assembly); XunitProjectAssembly assembly = new XunitProjectAssembly { AssemblyFilename = runner.Assembly, ConfigFilename = null, ShadowCopy = false }; project.AddAssembly(assembly); foreach (XunitProjectAssembly asm in project.Assemblies) { using (ExecutorWrapper wrapper = new ExecutorWrapper(asm.AssemblyFilename, asm.ConfigFilename, asm.ShadowCopy)) { try { var xunitRunner = new TestRunner(wrapper, logger); //Run all tests if (runner.Tests.Count() == 0 && runner.Members.Count() == 0 && runner.Namespaces.Count() == 0) xunitRunner.RunAssembly(); //Run tests if (runner.Tests.Count() > 0) { foreach (var test in runner.Tests) xunitRunner.RunTest(test.Substring(0, test.LastIndexOf(".")), test.Substring(test.LastIndexOf(".") + 1, test.Length - (test.LastIndexOf(".") + 1))); } //Run members if (runner.Members.Count() > 0) { foreach (var member in runner.Members) xunitRunner.RunClass(member); } //Run namespaces if (runner.Namespaces.Count() > 0) { var loadedAssembly = Assembly.LoadFrom(runner.Assembly); var types = loadedAssembly.GetExportedTypes(); loadedAssembly = null; foreach (var ns in runner.Namespaces) { foreach (Type type in types) if (ns == null || type.Namespace == ns) xunitRunner.RunClass(type.FullName); } } } catch (ArgumentException ex) { Console.WriteLine(ex.Message); } } } return logger.Results; }
public async void DoesEmailExistReturnFalse() { var runner = new TestRunner(services => services.Configure<IdentityOptions>(options => { options.Password.RequireUppercase = false; options.Password.RequireNonLetterOrDigit = false; options.Password.RequireDigit = false; })); string id = string.Empty; await runner.Setup((context, next) => { return Task.FromResult(0); }).Test((context, next) => { var userRepo = context.ApplicationServices.GetService<AccountUserRepository>(); var result = userRepo.DoesEmailExist(TestUserNameOne); result.Should().BeFalse(); return Task.FromResult(0); }) .Run(); }
public async void DoesUsernameExistReturnTrue() { var runner = new TestRunner(services => services.Configure<IdentityOptions>(options => { options.Password.RequireUppercase = false; options.Password.RequireNonLetterOrDigit = false; options.Password.RequireDigit = false; })); string id = string.Empty; await runner.Setup(async (context, next) => { var userManager = context.ApplicationServices.GetService<UserManager<AccountingUser>>(); var user = new AccountingUser { UserName = TestUserNameOne, Email = TestUserEmailOne }; var result = await userManager.CreateAsync(user, TestPassword); }) .Test((context, next) => { var userRepo = context.ApplicationServices.GetService<AccountUserRepository>(); var result = userRepo.DoesUsernameExist(TestUserNameOne); result.Should().BeTrue(); return Task.FromResult(0); }) .Run(); }