private static void ColourTest() { ColourManager colourManager = new ColourManager(new EfColourDal()); foreach (var colour in colourManager.GetAll()) { Console.WriteLine(colour.ColourName + "/" + colour.ColourId); } foreach (var colour in colourManager.GetById(3)) { Console.WriteLine(colour.ColourId + "/" + colour.ColourName); } Colour colourAdd = new Colour() { ColourName = "Dark Blue" }; colourManager.Add(colourAdd); foreach (var colour in colourManager.GetAll()) { Console.WriteLine(colour.ColourName + "/" + colour.ColourId); } colourManager.Delete(2002); foreach (var colours in colourManager.GetAll()) { Console.WriteLine(colours.ColourName); } colourManager.Update(1); }
private static void ColourDeleteTest() { ColourManager colourManager = new ColourManager(new EfColourDal()); Colour colour = new Colour(); colour.Id = 8; colour.ColourName = "Green"; colourManager.Add(colour); Console.WriteLine("Duplicate added for test"); Console.WriteLine(); ColourAllTest(); Console.WriteLine(); var result = colourManager.Delete(colour); Console.WriteLine(result.Message); Console.WriteLine(); Console.WriteLine("Duplicate removed"); Console.WriteLine(); ColourAllTest(); }