public void ScopingEndToEndWithCompositionService_PartitionedCatalogsShouldSucceed() { var c1 = new TypeCatalog(typeof(ClassRoot), typeof(ClassA)); var c2 = new TypeCatalog(typeof(ClassA)); CompositionScopeDefinition sd = c1.AsScope(c2.AsScope()); var container = new CompositionContainer(sd, CompositionOptions.ExportCompositionService); ClassRoot fromRoot = container.GetExportedValue <ClassRoot>(); ClassA a1 = fromRoot.classA.CreateExport().Value; ClassA a2 = fromRoot.classA.CreateExport().Value; fromRoot.localClassA.InstanceValue = 101; a1.InstanceValue = 202; a2.InstanceValue = 303; if (a1.InstanceValue == a2.InstanceValue) { throw new Exception("Incorrect sharing, a1 is shared with a2"); } var xroot = new ImportA(); var x1 = new ImportA(); var x2 = new ImportA(); fromRoot.localClassA.CompositionService.SatisfyImportsOnce(xroot); a1.CompositionService.SatisfyImportsOnce(x1); a2.CompositionService.SatisfyImportsOnce(x2); Assert.Equal(xroot.classA.InstanceValue, fromRoot.localClassA.InstanceValue); Assert.Equal(x1.classA.InstanceValue, a1.InstanceValue); Assert.Equal(x2.classA.InstanceValue, a2.InstanceValue); }
private void Button_Click(object sender, RoutedEventArgs e) { ClassRoot root = new ClassRoot(); double d = root.root(Convert.ToDouble(textPow.Text.Replace(".", ",")), Convert.ToDouble(textNumber.Text.Replace(".", ",")), Convert.ToDouble(textAcc.Text.Replace(".", ","))); labelRslt.Content = d.ToString(); d = root.chk(Convert.ToDouble(textPow.Text.Replace(".", ",")), Convert.ToDouble(textNumber.Text.Replace(".", ",")), Convert.ToDouble(textAcc.Text.Replace(".", ","))); labelChk.Content = d.ToString(); }
private void button1_Click(object sender, EventArgs e) { ClassRoot root = new ClassRoot(); double d = root.root(Convert.ToDouble(textPow.Text.Replace(".", ",")), Convert.ToDouble(textNumber.Text.Replace(".", ",")), Convert.ToDouble(textAccuracy.Text.Replace(".", ","))); labelResult.Text = d.ToString(); labelResult.Visible = true; d = root.chk(Convert.ToDouble(textPow.Text.Replace(".", ",")), Convert.ToDouble(textNumber.Text.Replace(".", ",")), Convert.ToDouble(textAccuracy.Text.Replace(".", ","))); labelChk.Text = d.ToString(); labelChk.Visible = true; }
static void Main(string[] args) { ClassRoot root = new ClassRoot(); Console.WriteLine("enter number"); double number = Convert.ToDouble(Console.ReadLine().Replace(".", ",")); Console.WriteLine("enter pow"); double pow = Convert.ToDouble(Console.ReadLine().Replace(".", ",")); Console.WriteLine("enter accuracy"); double accuracy = Convert.ToDouble(Console.ReadLine().Replace(".", ",")); double rt = root.root(pow, number, accuracy); Console.WriteLine(rt); double chk = root.chk(pow, number, accuracy); Console.WriteLine(chk); Console.ReadLine(); }