public static void Action(ITestModule module) { if (module.IsExactModule == false) { MakeSoftMistake(); } }
void OnAddTestModule() { var openFileDialog = new Microsoft.Win32.OpenFileDialog(); openFileDialog.Filter = "Dll Files (*.dll)|*.dll|Exe Files (*.exe)|*.exe"; var result = openFileDialog.ShowDialog(); string testModulePath = string.Empty; if (result == true) { testModulePath = openFileDialog.FileName; } else { return; } ITestModule testModule = TestModuleFactory.LoadTestModule(testModulePath); if (testModule == null) { return; } this.testModuleVMs.Add(new TestModuleVM(testModule)); RaisePropertyChanged("TestModuleVMs"); }
public void GivenThereAreMultipleSameTypedDependencies_WhenDependencyIsRegisteredByHandlerAndDependencyIsRegisteredByHandler_ThenResolutionOfDependenciesCollectionIsCorrect() { var modules = new ITestModule[] { new TestModule { Name = "1" }, new TestModule { Name = "2" } }; var container = new ExtendedSimpleIocContainer(); container.RegisterHandler(typeof(ITestModule), null, (c) => modules[0]); container.RegisterHandler(typeof(ITestModule), null, (c) => modules[1]); var actualModules = container.GetAllInstances(typeof(ITestModule)).ToArray(); CollectionAssert.AreEqual(modules, actualModules); }
public static void Run(ITestModule module, string singleTest = null) { if (singleTest == null) { foreach (var test in module) Run(test, module); return; } var selectedTest = module.FirstOrDefault(t => t.TestName == singleTest); if (selectedTest == null) throw new InvalidOperationException("Test not found"); //TODE Run(selectedTest, module); }
public static ITestModule LoadTestModule(string filePath) { if (!File.Exists(filePath)) { return(null); } ITestModule testModule = null; try { testModule = DotNetTestModule.LoadTestModule(filePath); return(testModule); } catch (Exception) { return(null); } }
public TestModuleVM(ITestModule testModule) : base(null, true) { this.testModule = testModule; }
public void Add(ITestModule testFramework) { _modules.Add(testFramework); }
static void Run(TestBuilder test, ITestModule module) { string last; var testTree = new List<TestBuilder>(new[] { test }); while ((last = testTree.First()._BasedOn) != null) { var current = module.FirstOrDefault(t => t.TestName == last); if (current == null) throw new InvalidOperationException("There is no test named \"" + last + "\" in this group."); if (testTree.Contains(current)) throw new InvalidOperationException(); testTree.Insert(0, current); } var arranger = new TestArranger(test.Settings); foreach (var arr in Filter(testTree, a => !a._UseParentArrange).SelectMany(a => a._Arrange)) { arr(arranger); arranger.SetAllSettingsToDefault(); } object result = null; Exception exception = null; Action work = () => { foreach (var act in Filter(testTree, a => !a._UseBaseAct).SelectMany(a => a._Act)) result = act(arranger); }; var throws = Filter(testTree, a => !a._UseBaseThrows).SelectMany(a => a._Throws); if (throws.Any()) { try { work(); } catch (Exception e) { exception = e; } } else { work(); } if (arranger.ShouldHaveBeenCalled.Any()) throw new InvalidOperationException("methods not called\n" + string.Join("\n", arranger.ShouldHaveBeenCalled)); //TODE foreach (var ass in Filter(testTree, a => !a._UseBaseAssert).SelectMany(a => a._Assert)) ass(arranger, result); foreach (var thr in throws) { if (exception == null) throw new InvalidOperationException(); //TODE if (!thr.Key.IsAssignableFrom(exception.GetType())) throw new InvalidOperationException();//TODE thr.Value(arranger, exception); } }
public AggregateModule(ITestModule test, SingletonModule s) { _test = test; _singleton = s; }
private void RegisterInstanceDependency(Action <ContainerScenarioDataStoreBase, ITestModule> valueSetter, ITestModule instance) { var container = _scenarioDataStoreBase.Container; var module = new TestModule { Name = "1" }; container.RegisterHandler(typeof(ITestModule), null, (c, r) => instance); valueSetter(_scenarioDataStoreBase, instance); }