public void Importing_A_Non_Existing_File_Should_Give_An_Error() { FriResImporter importer = null; List<AthleteModel> athletes = null; Given("we have a FriRes importer pointing to a non existing database file", () => { importer = new FriResImporter("nonexstingfile.ext"); }); When("we attempt import all athletes from the file", () => { try { LogWriter.getInstance().Write( "Importing_A_Non_Existing_File_Should_Give_An_Error, getAthletes()"); athletes = importer.getAthletes(); false.ShouldBeTrue(); } catch (FileNotFoundException) { // The call above should throw this exception. } }); Then("we should have got an exception"); }
//[TestMethod] public void We_Should_Be_Able_To_Export_A_Participant() { List<AthleteModel> athletes = null; Given("we have two participants in a list", () => { athletes = new List<AthleteModel>(); athletes.Add(new AthleteModel("Arne", "Hansen")); athletes.Add(new AthleteModel("Per", "Olsen")); }); When("we export the participant", () => { FriResExporter exporter = new FriResExporter(FriResImporterTest.DB_FILE); exporter.export(athletes); }); Then("the exported participants should exist in the access datbase", () => { FriResImporter importer = new FriResImporter(FriResImporterTest.DB_FILE); List<AthleteModel> athletesDb = importer.getAthletes(); athletesDb.ShouldBe(athletes); }); }