public static void Main() { IUserInterface userInterface = new ConsoleUserInterface(); IEngine engine = new MinesweeperEngine(userInterface); engine.Run(); }
public void Reports_WithRegisteredProducts_ShouldReturnCorrectly() { var userInterface = new ConsoleUserInterface(); var engine = new AirConditionerTestingSystemEngine(userInterface); var view = new AirConditionerView(engine); var firstAc = view.RegisterStationaryAirConditioner("Toshiba", "EX1000", "B", 1000); var secondAc = view.RegisterPlaneAirConditioner("Hitachi", "P320", 25, 750); var thirdAc = view.RegisterStationaryAirConditioner("Toshiba", "C60", "A", 780); var firstTest = view.TestAirConditioner("Toshiba", "EX1000"); var secondTest = view.TestAirConditioner("Hitachi", "P320"); var thirdTest = view.TestAirConditioner("Toshiba", "C60"); var result = view.FindAllReportsByManufacturer("Toshiba"); var expected = new StringBuilder(); expected.AppendLine("Reports from Toshiba:"); expected.AppendLine("Report"); expected.AppendLine("===================="); expected.AppendLine("Manufacturer: Toshiba"); expected.AppendLine("Model: C60"); expected.AppendLine("Mark: Passed"); expected.AppendLine("===================="); expected.AppendLine("Report"); expected.AppendLine("===================="); expected.AppendLine("Manufacturer: Toshiba"); expected.AppendLine("Model: EX1000"); expected.AppendLine("Mark: Passed"); expected.Append("===================="); Assert.AreEqual(expected.ToString(), result); }
static void Main(string[] args) { var io = new ConsoleUserInterface(); var db = new Database(); var engine = new Engine(io, db); engine.Run(); }
public void TestGenerateMatrix_InputOne() { IUserInterface userInterface = new ConsoleUserInterface(); Matrix matrix = new Matrix(userInterface); var actualMatrix = matrix.GenerateMatrix(); var expectedMatrix = new int[1, 1]; expectedMatrix[0, 0] = 1; CollectionAssert.AreEqual(expectedMatrix, actualMatrix); }
public static void Main() { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; IUserInterface userInterface = new ConsoleUserInterface(); var commandExecutor = new CommandExecutor(); IEngine engine = new IssueTrackerEngine(commandExecutor, userInterface); engine.Run(); }
public void Status_WithNoRegistered_Should_ReturnIncorrectly() { var userInterface = new ConsoleUserInterface(); var engine = new AirConditionerTestingSystemEngine(userInterface); var view = new AirConditionerView(engine); var result = view.Status(); Assert.AreEqual("Jobs complete: 0,00%", result); }
public void With_NullArgument() { // Arrange // Act var consoleUI = new ConsoleUserInterface(); // Assert consoleUI.Should().NotBeNull("because it was just created."); }
public static void Main() { var consoleUi = new ConsoleUserInterface(); var endCommandRecieved = false; while (!endCommandRecieved) { endCommandRecieved = consoleUi.ExecuteCommand(); } }
public void Registering_IncorrectACPowerUsage_ShouldThrowException() { var userInterface = new ConsoleUserInterface(); var engine = new AirConditionerTestingSystemEngine(userInterface); var view = new AirConditionerView(engine); var registeredAc = view.RegisterStationaryAirConditioner("Toshiba", "EX1000", "B", 1000); var secondAc = view.RegisterPlaneAirConditioner("Hitachi", "", 25, -200); var thirdAc = view.RegisterCarAirConditioner("Toshiba", "C60", 9); }
public void Registering_IncorrectACManufacturerName_ShouldThrowException() { var userInterface = new ConsoleUserInterface(); var engine = new AirConditionerTestingSystemEngine(userInterface); var view = new AirConditionerView(engine); var registeredAc = view.RegisterStationaryAirConditioner("Toshiba", "EX1000", "B", 1000); var secondAc = view.RegisterPlaneAirConditioner("Hit", "P320", 25, 750); var thirdAc = view.RegisterCarAirConditioner("Toshiba", "C60", 9); }
public static void Main() { IUserInterface userInterface = new ConsoleUserInterface(); int dimension = TakeMatrixDimension(userInterface); var matrixWalk = new Matrix(dimension); var matrix = matrixWalk.GenerateMatrix(); PrintMatrix(matrix, userInterface); }
// BUG: Fix bug in test 5. public static void Main() { ITestingSystemDatabase database = new ACDatabase(); IController controller = new Controller(database); ICommandManager commandManager = new CommandManager(controller); IUserInterface ui = new ConsoleUserInterface(); IEngine engine = new Engine(ui, commandManager); engine.Run(); }
public static void Main() { IAirConditionerTesterSystemData data = new AirConditionerTesterSystemData(); IController controller = new Controller(data); IDispatcher dispatcher = new Dispatcher(controller); IUserInterface userInterface = new ConsoleUserInterface(); IEngine engine = new AirConditionerTesterSystemEngine(dispatcher, userInterface); engine.Run(); }
public void With_NullArguments() { // Arrange var consoleUI = new ConsoleUserInterface(); // Act consoleUI.RunStoryUntilContinuationPoint(null, null, null); // Assert consoleUI.Should().NotBeNull("because it was just created."); }
public void Registering_CorrectAC_ShouldReturnCorrectly() { var userInterface = new ConsoleUserInterface(); var engine = new AirConditionerTestingSystemEngine(userInterface); var view = new AirConditionerView(engine); var registeredAc = view.RegisterStationaryAirConditioner("Toshiba", "EX1000", "B", 1000); var expected = "Air Conditioner model EX1000 from Toshiba registered successfully."; Assert.AreEqual(expected, registeredAc); }
public void Reports_WithNoRegisteredProducts_ShouldReturnCorrectly() { var userInterface = new ConsoleUserInterface(); var engine = new AirConditionerTestingSystemEngine(userInterface); var view = new AirConditionerView(engine); var result = view.FindAllReportsByManufacturer("Toshiba"); var expected = "No reports."; Assert.AreEqual(expected, result); }
public static void Main() // BUG: Fix bug in test 5. { ITestingSystemDatabase database = new ACDatabase(); IController controller = new Controller(database); ICommandManager commandManager = new CommandManager(controller); IUserInterface ui = new ConsoleUserInterface(); IEngine engine = new Engine(ui, commandManager); engine.Run(); }
public void TakeQuiz(bool immediateFeedback) { ConsoleUserInterface ui = new ConsoleUserInterface(); foreach (Question question in quiz.Questions) { question.DisplayAndGetAnswer(ui, immediateFeedback); } // Quiz is complete, give a final score ui.WriteLine($"Quiz is COMPLETE. Your score was {quiz.Score}%"); }
public static void Main(string[] args) { IUserInterface userInterface = new ConsoleUserInterface(); IBlobFactory blobFactory = new BlobFactory(); IBehaviorFactory behaviorFactory = new BehaviorFactory(); IAttackFactory attackFactory = new AttackFactory(); IDatabase database = new Database(); IEngine engine = new Engine(userInterface, attackFactory, blobFactory, behaviorFactory, database); engine.Run(); }
public static void Main(string[] args) { IUserInterface userInterface = new ConsoleUserInterface(); IBlobFactory blobFactory = new BlobFactory(); IBehaviorFactory behaviorFactory = new BehaviorFactory(); IAttackFactory attackFactory = new AttackFactory(); IDatabase database = new Database(); IEngine engine = new Engine(userInterface,attackFactory,blobFactory,behaviorFactory,database); engine.Run(); }
private static IGameEngine CreateGame( int successfulTurnsToWin, int numberOfRows, int numberOfColumns, int numberOfMines) { var gameBoard = new DemoFixedSizeMinesweeperBoard(); var scoreBoard = new ScoreBoard(typeof(ScoreCard)); var userInterFace = new ConsoleUserInterface(numberOfRows, numberOfColumns); var minesweeper = new MinesweeperEngine(successfulTurnsToWin, gameBoard, scoreBoard, userInterFace); return(minesweeper); }
public static void Main() { CultureInfo culture = (CultureInfo)CultureInfo.CurrentCulture.Clone(); culture.DateTimeFormat.ShortDatePattern = "dd-MMM-yyyy"; Thread.CurrentThread.CurrentCulture = culture; TicketCatalog ticketCatalog = new TicketCatalog(); IUserInterface userInterface = new ConsoleUserInterface(); IEngine engine = new TicketCatalogEngine(ticketCatalog, userInterface); engine.Run(); }
public static void Main(string[] args) { var context = new ProductsSystemDbContext(); // Execute the following method if do not have the // database in sql server // It will add sample data automatically // Firstly ensure that in the App.config file // you have the name of your sql server in the // connection string Configuration.InitializeDatabase(context); Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); var data = ProductsSystemData.GetInstance(context); var userInterface = new ConsoleUserInterface(); var engine = Engine.GetInstance(userInterface, data); engine.Run(); //var product = data.Sales.All() // .GroupBy(s => s.Product) // .Select(sp => new SalesByProduct // { // ProductId = sp.Key.Id, // ProductName = sp.Key.Name, // VendorName = sp.Key.Vendor.Name, // TotalQuantitySold = sp.Sum(s => s.Quantity), // TotalIncomes = sp.Sum(s => s.Quantity * s.Product.Price), // }).ToList(); //Product product = new Product(); //product.ExpiryDate = new DateTime(2008, 12, 28); //var defaultFileFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); //var filePath = defaultFileFolderPath + "\\json.txt"; //var serializer = new JsonSerializer(); //serializer.Converters.Add(new JavaScriptDateTimeConverter()); //serializer.NullValueHandling = NullValueHandling.Ignore; //using (var sw = new StreamWriter(filePath)) //using (JsonWriter writer = new JsonTextWriter(sw)) //{ // serializer.Serialize(writer, product); // // {"ExpiryDate":new Date(1230375600000),"Price":0} //} //var json = JsonExporter.JsonExporter.ToJson(product); //Console.WriteLine(json); }
public void Status_WithNoTested_Should_ReturnInCorrectly() { var userInterface = new ConsoleUserInterface(); var engine = new AirConditionerTestingSystemEngine(userInterface); var view = new AirConditionerView(engine); var firstAc = view.RegisterStationaryAirConditioner("Toshiba", "EX1000", "B", 1000); var secondAc = view.RegisterPlaneAirConditioner("Hitachi", "P320", 25, 750); var thirdAc = view.RegisterCarAirConditioner("Toshiba", "C60", 9); var result = view.Status(); Assert.AreEqual("Jobs complete: 0,00%", result); }
public void GameEngine_PlayerBIsNull_ThrowException() { var playerA = new Player("ROGER"); Player playerB = null; var randomPointResultEngine = new RandomPointResultEngine(); var gameScoreManager = new GameScoreManager(); var consoleUserInterface = new ConsoleUserInterface(); var gameEngine = new GameEngine(randomPointResultEngine, gameScoreManager, consoleUserInterface, playerA, playerB); }
private static void Main(string[] args) { var userInterface = new ConsoleUserInterface(); var employee = userInterface.GetEmployeeDetails(); var paymentStart = userInterface.GetPaymentStartDate(); var paymentEnd = userInterface.GetPaymentEndDate(); const string taxBracketsFilePath = "./Resources/nzTaxBrackets.json"; var taxBracketsReader = new JSONTaxBracketsFileReader(taxBracketsFilePath); var taxBrackets = taxBracketsReader.GetTaxBrackets(); var nzTaxRateSchedule = new NzTaxRateSchedule(taxBrackets); var empPaySlip = employee.GetMonthlyPaySlip(paymentStart, paymentEnd, nzTaxRateSchedule); userInterface.DisplayPaySlip(empPaySlip); }
static void Main(string[] args) { var validator = new StrictAnswerValidator(); var parser = new FileIniDataParserExtension(new FileIniDataParser()); var vocabProvider = new IniFileVocabDataProvider(parser); var ui = new ConsoleUserInterface(); ui.Start(); var settingsIndex = ui.GetSettingsIndex(); var settings = ExamSettingsFactory.Build((ExamSettingsFactory.SettingTypes)settingsIndex); var iterator = new Iterator(settings, vocabProvider); var calculator = new Calculator(iterator.Count()); var handler = new Handler(ui, settings, iterator, calculator, validator); handler.Run(); ui.Quit(calculator); }
public void Reports_WithRegisteredProducts_ShouldReturnNoReports() { var userInterface = new ConsoleUserInterface(); var engine = new AirConditionerTestingSystemEngine(userInterface); var view = new AirConditionerView(engine); var firstAc = view.RegisterStationaryAirConditioner("Toshiba", "EX1000", "B", 1000); var secondAc = view.RegisterPlaneAirConditioner("Hitachi", "P320", 25, 750); var thirdAc = view.RegisterStationaryAirConditioner("Toshiba", "C60", "A", 780); var firstTest = view.TestAirConditioner("Toshiba", "EX1000"); var secondTest = view.TestAirConditioner("Toshiba", "C60"); var result = view.FindAllReportsByManufacturer("Hitachi"); var expected = "No reports."; Assert.AreEqual(expected, result); }
static void Main(string[] args) { var fillOutFormFilePath = "./files/fillOutForm.json"; var paySlipFilePath = "./files/paySlip.json"; var taxRatesInfoFilePath = "./files/taxRatesInfo.json"; var paySlipConsole = new ConsoleUserInterface(); var json = new JsonFileReader(fillOutFormFilePath); var formQuestions = json.ParseBasicFormFile(); var personDetails = paySlipConsole.GetPersonDetails(formQuestions); var paymentDetails = new PaymentDetails(Convert.ToInt32(personDetails["annualSalary"]), Convert.ToInt32(personDetails["superRate"]), personDetails["paymentStartDate"], personDetails["paymentEndDate"]); var employee = new Employee(personDetails["firstName"], personDetails["lastName"], paymentDetails); var taxRates = new JsonFileReader(taxRatesInfoFilePath).ParseTaxRatesInfoFile(); var paySlip = new PaySlip(employee, taxRates); // var paySlipForm = new JsonFileReader(paySlipFilePath).ParseBasicFormFile(); // paySlipConsole.PrintPaySlip(paySlip, paySlipForm); }
static void Main(string[] args) { try { var playerA = new Player("ROGER"); var playerB = new Player("RAFA"); var randomPointResultEngine = new RandomPointResultEngine(); var gameScoreManager = new GameScoreManager(); var consoleUserInterface = new ConsoleUserInterface(); var gameEngine = new GameEngine(randomPointResultEngine, gameScoreManager, consoleUserInterface, playerA, playerB); gameEngine.PlayGame(); } catch (System.Exception ex) { System.Console.WriteLine(ex); } }
public static void Main(string[] args) { var context = new ProductsSystemDbContext(); // Execute the following method if do not have the // database in sql server // It will add sample data automatically // Firstly ensure that in the App.config file // you have the name of your sql server in the // connection string Configuration.InitializeDatabase(context); Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); var data = ProductsSystemData.GetInstance(context); var userInterface = new ConsoleUserInterface(); var engine = Engine.GetInstance(userInterface, data); engine.Run(); //var product = data.Products.All().Select( // p => new {ProductName = p.Name, VendorName = p.Vendor.Name, QuantitySold = p.Sales.Sum(s => s.Quantity * p.Price)}); //var json = JsonExporter.JsonExporter.ToJson(product); //Console.WriteLine(json); }
public static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler; var algorithmsList = new List <IAlgorithmItem> { new SumOfMultiple.Processor(), new SequenceAnalysis.Processor() }; IUserInterface userInterface = new ConsoleUserInterface(); while (true) { var selectedAlgorithm = userInterface.GetAlgorithm(algorithmsList); if (selectedAlgorithm == null) { break; } try { var input = userInterface.GetInput(selectedAlgorithm); var result = selectedAlgorithm.Process(input); userInterface.DisplayOutput(result); } catch (Exception ex) { ExceptionHandler(ex); } } PauseBeforeExit(); }
public ConsoleDialogController(IApplicationController applicationController) : base(applicationController) { UserInterface = new ConsoleUserInterface(true); }
public static void Main() { ConsoleUserInterface consoleUserInterface = new ConsoleUserInterface(); consoleUserInterface.Start(); }
public void ExecuteCommands() { var ui = new ConsoleUserInterface(); var command = this.Run.Command; try { switch (command.Name) { case "RegisterStationaryAirConditioner": this.ValidateParametersCount(command, 4); ui.WriteLine(this.RegisterStationaryAirConditioner( command.Parameters[0], command.Parameters[1], command.Parameters[2], int.Parse(command.Parameters[3]))); break; case "RegisterCarAirConditioner": this.ValidateParametersCount(command, 3); ui.WriteLine(this.RegisterCarAirConditioner( command.Parameters[0], command.Parameters[1], int.Parse(command.Parameters[2]))); break; case "RegisterPlaneAirConditioner": this.ValidateParametersCount(command, 4); ui.WriteLine(this.RegisterPlaneAirConditioner( command.Parameters[0], command.Parameters[1], int.Parse(command.Parameters[2]), int.Parse(command.Parameters[3]))); break; case "TestAirConditioner": this.ValidateParametersCount(command, 2); ui.WriteLine(this.TestAirConditioner( command.Parameters[0], command.Parameters[1])); break; case "FindAirConditioner": this.ValidateParametersCount(command, 2); ui.WriteLine(this.FindAirConditioner( command.Parameters[0], command.Parameters[1])); break; case "FindReport": this.ValidateParametersCount(command, 2); ui.WriteLine(this.FindReport( command.Parameters[0], command.Parameters[1])); break; case "FindAllReportsByManufacturer": this.ValidateParametersCount(command, 1); ui.WriteLine(this.FindAllReportsByManufacturer( command.Parameters[0])); break; case "Status": this.ValidateParametersCount(command, 0); ui.WriteLine(this.Status()); break; default: throw new IndexOutOfRangeException(Constants.Invalidcommand); } } catch (ArgumentException ex) { ui.WriteLine(ex.Message); } catch (NonExistantEntryException ex) { ui.WriteLine(ex.Message); } catch (DuplicateEntryException ex) { ui.WriteLine(ex.Message); } catch (FormatException ex) { throw new InvalidOperationException(Constants.Invalidcommand, ex.InnerException); } catch (IndexOutOfRangeException ex) { throw new InvalidOperationException(Constants.Invalidcommand, ex.InnerException); } }
static Program() { UI = new ConsoleUserInterface(); }