public void GetCompilerTest() { var target = new Compilers("Directory"); Assert.AreEqual(target.Count, 0); var newCompiler = new Compiler(); newCompiler.Name = "CPP"; target.AddCompiler(newCompiler); var result = target.GetCompiler("CPP"); Assert.AreNotEqual(result, null); Assert.AreEqual("CPP", result.Name); result = target.GetCompiler("BadName"); Assert.AreEqual(result, null); }
public void GetCompilersTest() { var target = new Compilers("Directory"); var newCompiler = new Compiler(); newCompiler.Name = "CPP"; var resultList = target.GetCompilers(); Assert.AreEqual(resultList.Count, 0); target.AddCompiler(newCompiler); resultList = target.GetCompilers(); Assert.AreEqual(resultList.Count, 1); }
public void ContainsTest() { var target = new Compilers("Directory"); Assert.AreEqual(target.Count, 0); var newCompiler = new Compiler(); newCompiler.Name = "CPP"; target.AddCompiler(newCompiler); var result = target.Contains("CPP"); Assert.AreEqual(true, result); result = target.Contains("BadCompilerName"); Assert.AreEqual(result, false); }
public void ClearTest() { var target = new Compilers("Directory"); Assert.AreEqual(target.Count, 0); target.AddCompiler(new Compiler()); Assert.AreEqual(target.Count, 1); target.Clear(); Assert.AreEqual(target.Count, 0); }
public void AddCompilerTest() { var compilersDirectory = "Directory"; Compilers target; try { target = new Compilers(compilersDirectory); target.AddCompiler(null); Assert.AreEqual(false, true); } catch (Exception) { Assert.AreEqual(true, true); } try { target = new Compilers(compilersDirectory); Assert.AreEqual(target.Count, 0); target.AddCompiler(new Compiler()); Assert.AreEqual(target.Count, 1); } catch (Exception) { Assert.AreEqual(true, false); } }
public void AddDuplicateCompilerTest() { //creating Compilers from compilers folder var firstCompilers = new Compilers("Compilers"); //initialization firstCompilers.Load(); //trying to add compiler of CPP8 which actually is in Compilers right now ! firstCompilers.AddCompiler(firstCompilers.GetCompiler("CPP8")); //compilers must be unique. same compiler can not be added, thats why test fails yet. Assert.AreEqual(firstCompilers.Count,4); }
public void AddDuplicateCompilerTest() { var firstCompilers = new Compilers("Compilers"); firstCompilers.Load(); firstCompilers.AddCompiler(firstCompilers.GetCompiler("CPP8")); //compilers must be unique. same compiler can not be added. Assert.AreEqual(firstCompilers.Count,4); }