public override void FeatureActivated(SPFeatureReceiverProperties properties) { // install the service CalcService service = SPFarm.Local.Services.GetValue <CalcService>(); if (service == null) { service = new CalcService(SPFarm.Local); service.Update(); } // install the service proxy CalcServiceProxy serviceProxy = SPFarm.Local.ServiceProxies.GetValue <CalcServiceProxy>(); if (serviceProxy == null) { serviceProxy = new CalcServiceProxy(SPFarm.Local); serviceProxy.Update(true); } // with service added to the farm, install instance CalcServiceInstance serviceInstance = new CalcServiceInstance(SPServer.Local, service); serviceInstance.Update(true); }
static void Main(string[] args) { int n = 100; List <double> massA = new List <double>(); List <double> massB = new List <double>(); for (int i = 0; i < n; i++) { massA.Add(1.0); massB.Add(1.0); } CalcService calcservice = new CalcService(); InputMatrixes inputMatr = new InputMatrixes(); inputMatr.Mass_a = massA.ToArray(); inputMatr.Mass_b = massB.ToArray(); calcservice.SumMatrixes(inputMatr); OutputMatrixes output = calcservice.SumMatrixes(inputMatr); for (int j = 0; j < output.Mass_summ.Length; j += 2) { Console.Write(output.Mass_summ[j]); } Console.ReadKey(); }
static void Main(string[] args) { Server server = null; try { server = new Server() { Services = { CalcService.BindService(new CalcServiceImpl()) }, Ports = { new ServerPort("localhost", Port, ServerCredentials.Insecure) } }; server.Start(); Console.WriteLine("The server is listening on the port : " + Port); Console.ReadKey(); } catch (IOException e) { Console.WriteLine("The server failed to start : " + e.Message); throw; } finally { if (server != null) { server.ShutdownAsync().Wait(); } } }
void UpdateQuestionTBox() { questionTimeTBl.Text = String.Format("Времени на тест: {0} часов {1} минут {2} секунд", CalcService.CalcHours(questionTime), CalcService.CalcMinutes(questionTime), CalcService.CalcSeconds(questionTime)); }
public void TestEvenNumberWithBoolCompare(int x, bool expectedResult) { var cs = new CalcService(); var actualResult = cs.IsEven(x); Assert.Equal(expectedResult, actualResult); }
public void TestMultiplyNumbers(int x, int y, int expectedResult) { var cs = new CalcService(); var actualResult = cs.MultiplyNumbers(x, y); Assert.Equal(expectedResult, actualResult); }
public override void FeatureDeactivating(SPFeatureReceiverProperties properties) { // uninstall the instance CalcServiceInstance serviceInstance = SPFarm.Local.Services.GetValue <CalcServiceInstance>(); if (serviceInstance != null) { SPServer.Local.ServiceInstances.Remove(serviceInstance.Id); } // uninstall the service proxy CalcServiceProxy serviceProxy = SPFarm.Local.ServiceProxies.GetValue <CalcServiceProxy>(); if (serviceProxy != null) { SPFarm.Local.ServiceProxies.Remove(serviceProxy.Id); } // uninstall the service CalcService service = SPFarm.Local.Services.GetValue <CalcService>(); if (service != null) { SPFarm.Local.Services.Remove(service.Id); } }
void UpdatePassTBox() { passTimeTBl.Text = String.Format("Времени на вопрос: {0} часов {1} минут {2} секунд", CalcService.CalcHours(passTime), CalcService.CalcMinutes(passTime), CalcService.CalcSeconds(passTime)); }
public void TestSubtractNumbers(int x, int y, int expectedResult) { var cs = new CalcService(); var result = cs.SubtractNumbers(x, y); Assert.Equal(expectedResult, result); }
static void x() { List <Product> lista = new List <Product>(); Console.Write("Enter N: "); int n = int.Parse(Console.ReadLine()); for (int i = 0; i < n; i++) { string[] array = Console.ReadLine().Split(","); string nm = array[0]; double pr = double.Parse(array[1], CultureInfo.InvariantCulture); lista.Add(new Product(nm, pr)); } CalcService calc = new CalcService(); Product mx = calc.Max(lista); Console.WriteLine(); Console.WriteLine("Max: "); Console.WriteLine(mx); }
public void TestEvenNumberForTrueResult(int x) { var cs = new CalcService(); var actualResult = cs.IsEven(x); Assert.True(actualResult); }
public void TestEvenOrOdd(int x, bool isEven) { var cs = new CalcService(); var actualResult = cs.IsEvenOrOdd(x); Assert.Equal(isEven, actualResult); }
void CreateTest() { // Добавляем тест в БД Tests test = new Tests() { AuthorID = UsersService.currentUser.id, Name = testNameTBox.Text, PassTime = CalcService.HoursToSeconds((int)passHoursTBox.Value) + CalcService.MinutesToSeconds((int)passMinutesTBox.Value) + Convert.ToInt32(passSecondsTBox.Value), QuestionTime = CalcService.HoursToSeconds((int)questionHoursTBox.Value) + CalcService.MinutesToSeconds((int)questionMinutesTBox.Value) + Convert.ToInt32(questionSecondsTBox.Value), NumToPassFive = Convert.ToInt32(passFiveTBox.Value), NumToPassFour = Convert.ToInt32(passFourTBox.Value), NumToPassThree = Convert.ToInt32(passThreeTBox.Value) }; MainClass.db.Tests.Add(test); MainClass.db.SaveChanges(); TestsService.isEditingTest = true; TestsService.editingTest = test; //TestsService.addedTest = test; }
public void Run(string[] args) { cli = new CLI(args); cli.Run(); var arguments = new CLI(args).ReadArguments <CalcArguments>(); argumentExpression = new ArgumentExpressionReader(arguments); calcService = new CalcService(new MathOptions(arguments.ShouldDenyNegative, arguments.LargestNumber, arguments.MaximumNumbers)); MathExpressionResult mathExpression = null; if (argumentExpression.HasArgumentExpression()) { mathExpression = argumentExpression.Get(); } else { mathExpression = GetExpressionFromConsole(); } var result = calcService.RunExpression(mathExpression.Op, mathExpression.Expression); WriteResult(mathExpression, result); }
public ActionResult MultOption(CalcModel Model) { var result = new CalcResultModel(); CalcService Service = new CalcService(); result.result = Service.Multiply(Model); return(Ok(result)); }
public ActionResult Process(CalcViewModel model) { var cs = new CalcService(); var result = cs.AddNumbers(model.Number1, model.Number2); model.Result = result; return(View(model)); }
public ActionResult Multiply(CalcViewModel model) { var cs = new CalcService(); var result = cs.MultiplyNumbers(model.Number1, model.Number2); model.Result = result; return(View("Process", model)); }
public void EqualsRequiredCalcModelTestTwo(int firstOperandAct, int secondOperandAct, char operationAct, int resultExp) { var act = new CalcService(); RequiredCalcModel requiredCalcModel = new RequiredCalcModel(firstOperandAct, secondOperandAct, operationAct); var res = act.Operations(requiredCalcModel); Assert.NotEqual(resultExp, res); }
public ActionResult Divide(CalcViewModel model) { var cs = new CalcService(); var result = cs.SafeDivide(model.Number1, model.Number2); model.Result = result; return(View("Process", model)); }
public CalcServerManager() { _server = new Server { Services = { CalcService.BindService(new CalcServiceImplementation()) }, Ports = { new ServerPort("localhost", 1234, ServerCredentials.Insecure) } }; }
public ActionResult SubOption(CalcModel Model) { var result = new CalcResultModel(); CalcService Service = new CalcService(); result.result = Service.Subtract(Model); return(Ok(result)); }
public void TestDivideByZero(int x, int y) { var cs = new CalcService(); //var actualResult = cs.UnsafeDivide(x, y); Exception ex = Assert .Throws <DivideByZeroException>(() => cs.UnsafeDivide(x, y)); }
public ActionResult DivOption(CalcModel Model) { var result = new CalcResultModel(); CalcService Service = new CalcService(); result.result = Service.Divide(Model); return(Ok(result)); }
public void AddValidationTest() { var service = new CalcService(new LoggerMock()); Assert.Throws <ApplicationException>(() => { service.Add(new[] { 1, float.PositiveInfinity }); }); }
public IActionResult GetResult(string operand1, int operation, string operand2) { var formula = new LinkedList <string>(); formula.AddLast(operand1); formula.AddLast(operation.ToString()); formula.AddLast(operand2); return(Ok(CalcService.GetTwoArgumentResult(formula))); }
public void TestMethod1() { int x = 10; int y = 15; //int z = x + y; CalcService calcService = new CalcService(); int result = calcService.Add(x, y); Assert.AreEqual(15, result); }
public void TestAddNumbers(int x, int y, int expectedResult) { // 1. Arrange var cs = new CalcService(); // 2. Act var result = cs.AddNumbers(x, y); // 3. Assert Assert.Equal(expectedResult, result); }
/// <summary> /// Определение расчетного сервиса по Options /// </summary> /// <returns>Изменилось или нет</returns> public bool DefineCalcService() { bool res = false; if (CalcService == null || !CalcService.IsIdenticalOptions(Options)) { CalcService = InsService.GetCalcService(Options); res = true; } return(res); }
public void CalcServiceNullValueCheck_NotNull() { Product product = new Product() { Type = ProductType.Bicycle, Quantity = 2, UnitPrice = 500.0M }; ICalcService calcService = new CalcService(product); Assert.IsNotNull(calcService); }
public void CheckCalcServiceOnNull2() { // 1. Arrange var cs = new CalcService(); // 2. Act var result = cs.CombineAlbumsAndPhotos(new List <Album>(), null); // 3. Assert Assert.IsTrue(result != null && !result.Any(), $"The CombineAlbumsAndPhotos function shouldn't retrieve any results"); }
private void calcTarget(Calc calc) { this.service = this.services.ElementAt(this.targetService); switch (targetField) { case 0: this.service.InitialAmount(calc); break; case 1: this.service.MonthQtd(calc); break; case 2: this.service.InterestRate(calc); break; case 3: this.service.TotalAmount(calc); break; } }
public void init() { _mockData = new Mock<IData>(); _mockData.Setup(d => d.GetAllNodes()).Returns(TestData()); _calc = new CalcService(_mockData.Object); }