protected override void Check() { var c1 = new C <int> { F = 99 }; var c2 = new C <bool> { F = true }; var m = InitializeModel(c1, c2); _hasConstructorRun = false; Create(m); StateFormulas.ShouldBeEmpty(); RootComponents.Length.ShouldBe(2); var root1 = RootComponents[0]; root1.ShouldBeOfType <C <int> >(); ((C <int>)root1).F.ShouldBe(99); var root2 = RootComponents[1]; root2.ShouldBeOfType <C <bool> >(); ((C <bool>)root2).F.ShouldBe(true); _hasConstructorRun.ShouldBe(false); }
protected override void Check() { var c = new C(); var m = InitializeModel(c); var e1 = c.F.AddEffect <C.Effect1>(c); var e2 = c.F.AddEffect <C.Effect2>(c); e1.X = 17; e2.X = 18; e2.Y = 19; Create(m); StateFormulas.ShouldBeEmpty(); RootComponents.Length.ShouldBe(1); var root = RootComponents[0]; root.ShouldBeOfType <C.Effect2>(); root.GetSubcomponents().ShouldBeEmpty(); ((C)root).F.ShouldBeOfType <TransientFault>(); ((C.Effect1)root).X.ShouldBe(17); ((C.Effect2)root).X.ShouldBe(18); ((C.Effect2)root).Y.ShouldBe(19); root.FaultEffects.Count.ShouldBe(2); ((C.Effect1)root.FaultEffects[0]).X.ShouldBe(17); ((C.Effect2)root.FaultEffects[1]).X.ShouldBe(18); ((C.Effect2)root.FaultEffects[1]).Y.ShouldBe(19); typeof(C.Effect1).GetField("__fault__", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(root).ShouldBe(((C)root).F); typeof(C.Effect2).GetField("__fault__", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(root).ShouldBe(((C)root).F); }
protected override void Check() { var d = new D(); Should.Throw <UnboundPortException>(() => d.R()); Should.Throw <UnboundPortException>(() => { var x = d.A; }); Should.Throw <UnboundPortException>(() => d.B = 0); Should.Throw <UnboundPortException>(() => { var x = d.C; }); Should.Throw <UnboundPortException>(() => d.C = 0); var m = InitializeModel(d); Create(m); StateFormulas.ShouldBeEmpty(); RootComponents.Length.ShouldBe(1); RuntimeModel.StateVectorLayout.Groups.ShouldBeEmpty(); var root = RootComponents[0]; root.ShouldBeOfType <D>(); d = (D)root; Should.Throw <UnboundPortException>(() => d.R()); Should.Throw <UnboundPortException>(() => { var x = d.A; }); Should.Throw <UnboundPortException>(() => d.B = 0); Should.Throw <UnboundPortException>(() => { var x = d.C; }); Should.Throw <UnboundPortException>(() => d.C = 0); }
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); }
protected override void Check() { var c = new C(); var m = InitializeModel(c); ((C.Effect1)c.FaultEffects[0]).F = 17; _hasConstructorRun = false; Create(m); StateFormulas.ShouldBeEmpty(); RootComponents.Length.ShouldBe(1); var root = RootComponents[0]; root.ShouldBeOfType <C.Effect1>(); root.GetSubcomponents().ShouldBeEmpty(); ((C)root).F1.ShouldBeOfType <TransientFault>(); ((C.Effect1)root).F.ShouldBe(17); root.FaultEffects.Count.ShouldBe(1); ((C.Effect1)root.FaultEffects[0]).F.ShouldBe(17); typeof(C.Effect1).GetField("__fault__", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(root).ShouldBe(((C)root).F1); _hasConstructorRun.ShouldBe(false); }
protected override void Check() { var c = new C { F1 = 99, F2 = 12, F3 = -1, F4 = 3 }; var m = InitializeModel(c); _hasConstructorRun = false; Create(m); StateVectorSize.ShouldBe(4); StateFormulas.ShouldBeEmpty(); RootComponents.Length.ShouldBe(1); var root = RootComponents[0]; root.ShouldBeOfType <C>(); ((C)root).F1.ShouldBe(5); ((C)root).F2.ShouldBe(5); ((C)root).F3.ShouldBe(0); ((C)root).F4.ShouldBe(3); root.GetSubcomponents().ShouldBeEmpty(); _hasConstructorRun.ShouldBe(false); }
protected override void Check() { var c = new C(); var a = new[] { 1, 2, 3 }; var m = InitializeModel(c); _hasConstructorRun = false; Create(m); StateFormulas.ShouldBeEmpty(); RootComponents.Length.ShouldBe(1); var root = RootComponents[0]; root.ShouldBeOfType <C>(); c = (C)root; c.AnyWithoutPredicate(a).ShouldBe(true); c.Any(a, x => x > 1).ShouldBe(true); c.Any(a, x => x > 10).ShouldBe(false); c.All(a, x => x > 1).ShouldBe(false); c.All(a, x => x < 10).ShouldBe(true); _hasConstructorRun.ShouldBe(false); }
protected override void Check() { var c1 = new C { F = 99 }; var c2 = new C { F = 33 }; var d = new D { C1 = c1, C2 = c2 }; var m = InitializeModel(d); _hasConstructorRun = false; Create(m); StateFormulas.ShouldBeEmpty(); RootComponents.Length.ShouldBe(1); var root = RootComponents[0]; root.ShouldBeOfType <D>(); ((D)root).C1.ShouldBeOfType <C>(); ((D)root).C2.ShouldBeOfType <C>(); ((D)root).C1.F.ShouldBe(99); ((D)root).C2.F.ShouldBe(33); root.GetSubcomponents().ShouldBe(new[] { ((D)root).C1, ((D)root).C2 }); ((D)root).C1.GetSubcomponents().ShouldBeEmpty(); ((D)root).C2.GetSubcomponents().ShouldBeEmpty(); _hasConstructorRun.ShouldBe(false); }
protected override void Check() { var d = new D { T = typeof(object) }; var m = InitializeModel(d); Create(m); StateFormulas.ShouldBeEmpty(); RootComponents.Length.ShouldBe(1); StateSlotCount.ShouldBe(1); var root = RootComponents[0]; root.ShouldBeOfType <D>(); ((D)root).T.ShouldBe(typeof(object)); }
protected override void Check() { var c = new C { F = 33 }; var d = new D { C = c }; var e = new E { C = new [] { c } }; var f = new F { E = e }; c.D = d; c.E = new List <E> { e }; e.F = f; var m = InitializeModel(d); _hasConstructorRun = false; Create(m); StateFormulas.ShouldBeEmpty(); RootComponents.Length.ShouldBe(1); var root = RootComponents[0]; root.ShouldBeOfType <D>(); ((D)root).C.ShouldBeOfType <C>(); ((D)root).C.D.ShouldBeOfType <D>(); ((D)root).C.D.ShouldBe((D)root); ((D)root).C.F.ShouldBe(33); root.GetSubcomponents().ShouldBe(new[] { ((D)root).C }); ((D)root).C.GetSubcomponents().ShouldBe(new[] { root }); _hasConstructorRun.ShouldBe(false); }
protected override void Check() { var d = new D { G = 3 }; var m = InitializeModel(d); Create(m); StateFormulas.ShouldBeEmpty(); RootComponents.Length.ShouldBe(1); StateSlotCount.ShouldBe(2); var root = RootComponents[0]; root.ShouldBeOfType <D>(); ((D)root).G.ShouldBe(3); ((D)root).C.F.ShouldBe(-1); }
protected override void Check() { var c1 = new C1 <int> { F = 33 }; var c2 = new C2 { L = Int64.MaxValue }; var c3 = new C1 <bool> { F = true }; var d = new D { C = new IComponent[] { c1, c2, c3 } }; var m = InitializeModel(d); _hasConstructorRun = false; Create(m); StateFormulas.ShouldBeEmpty(); RootComponents.Length.ShouldBe(1); var root = RootComponents[0]; root.ShouldBeOfType <D>(); ((D)root).C[0].ShouldBeOfType <C1 <int> >(); ((D)root).C[1].ShouldBeOfType <C2>(); ((D)root).C[2].ShouldBeOfType <C1 <bool> >(); ((C1 <int>)((D)root).C[0]).F.ShouldBe(33); ((C2)((D)root).C[1]).L.ShouldBe(Int64.MaxValue); ((C1 <bool>)((D)root).C[2]).F.ShouldBe(true); root.GetSubcomponents().ShouldBe(new[] { ((D)root).C[0], ((D)root).C[1], ((D)root).C[2] }); ((Component)((D)root).C[0]).GetSubcomponents().ShouldBeEmpty(); ((Component)((D)root).C[1]).GetSubcomponents().ShouldBeEmpty(); ((Component)((D)root).C[2]).GetSubcomponents().ShouldBeEmpty(); _hasConstructorRun.ShouldBe(false); }
protected override void Check() { var d = new D { A = 7, C = 3 }; var r = new PortReference(d, typeof(D), "M", new[] { typeof(bool), typeof(int) }, typeof(bool), false); var p = new PortReference(d, typeof(D), "Q", new[] { typeof(bool), typeof(int) }, typeof(bool), true); d.B = new PortBinding(r, p); var m = InitializeModel(d); Create(m); StateFormulas.ShouldBeEmpty(); RootComponents.Length.ShouldBe(1); StateSlotCount.ShouldBe(2); var root = RootComponents[0]; root.ShouldBeOfType <D>(); r = ((D)root).B.RequiredPort; p = ((D)root).B.ProvidedPort; r.TargetObject.ShouldBe(root); r.DeclaringType.ShouldBe(typeof(D)); r.PortName.ShouldBe("M"); r.ArgumentTypes.ShouldBe(new[] { typeof(bool), typeof(int) }); r.ReturnType.ShouldBe(typeof(bool)); r.IsVirtualCall.ShouldBe(false); p.TargetObject.ShouldBe(root); p.DeclaringType.ShouldBe(typeof(D)); p.PortName.ShouldBe("Q"); p.ArgumentTypes.ShouldBe(new[] { typeof(bool), typeof(int) }); p.ReturnType.ShouldBe(typeof(bool)); p.IsVirtualCall.ShouldBe(true); ((D)root).A.ShouldBe(7); ((D)root).C.ShouldBe(3); }
protected override void Check() { var c = new C { F = 99 }; var m = InitializeModel(c); _hasConstructorRun = false; Create(m); StateFormulas.ShouldBeEmpty(); RootComponents.Length.ShouldBe(1); var root = RootComponents[0]; root.ShouldBeOfType <C>(); ((C)root).F.ShouldBe((sbyte)99); root.GetSubcomponents().ShouldBeEmpty(); _hasConstructorRun.ShouldBe(false); }
protected override void Check() { var m = new M(); _hasConstructorRun = false; Create(m); StateFormulas.ShouldBeEmpty(); RootComponents.Length.ShouldBe(1); var root = RootComponents[0]; root.ShouldBeOfType <C>(); ((C)root).F.ShouldBe((sbyte)99); ((C)root).Model.Components.ShouldBe(new[] { root }); ((C)root).Model.Roots.ShouldBe(new[] { root }); ((C)root).Model.Faults.ShouldBeEmpty(); ((C)root).Model.ReferencedObjects.ShouldBe(new object[] { root, ((C)root).Model }); root.GetSubcomponents().ShouldBeEmpty(); _hasConstructorRun.ShouldBe(false); }
protected override void Check() { var c = new C { F = 9 }; var d = new D { C = c }; var m = InitializeModel(d); Create(m); StateFormulas.ShouldBeEmpty(); RootComponents.Length.ShouldBe(1); RuntimeModel.StateVectorLayout.Groups.ShouldBeEmpty(); var root = RootComponents[0]; root.ShouldBeOfType <D>(); ((D)root).C.ShouldBe(null); }
protected override void Check() { var c = new C(); var m = InitializeModel(c); _hasConstructorRun = false; Create(m); StateFormulas.ShouldBeEmpty(); RootComponents.Length.ShouldBe(1); var root = RootComponents[0]; root.ShouldBeOfType <C>(); c = (C)root; c.Funcs.Length.ShouldBe(2); c.Funcs[0]().ShouldBe(true); c.Funcs[1]().ShouldBe(false); _hasConstructorRun.ShouldBe(false); }
protected override void Check() { var o0 = new V(); var o1 = new V { Y = 1 }; var o2 = new V { Y = 2 }; var o3 = new V { Y = 3 }; var o4 = new V { Y = 4 }; var o5 = new V { Y = 5 }; var o6 = new V { Y = 6 }; var o7 = new V { Y = 7 }; var o8 = new V { Y = 8 }; var o9 = new V { Y = 9 }; var o10 = new V { Y = 10 }; var o11 = new V { Y = 11 }; var o12 = new V { Y = 12 }; var o13 = new V { Y = 13 }; var o14 = new V { Y = 14 }; var o15 = new V { Y = 15 }; var c = new C { E = new Y { X = new X { O = o0 } }, F = new X { O = o1 }, G = new[] { new X { O = o2 } }, H = new[] { new X { O = o3 } }, I = new[] { new X { O = o4 } }, J = new[] { new X { O = o5 } }, K = new[] { new X { O = o6 } }, GL = new List <X> { new X { O = o9 } }, HL = new List <X> { new X { O = o10 } }, IL = new List <X> { new X { O = o11 } }, JL = new List <X> { new X { O = o12 } }, KL = new List <X> { new X { O = o13 } } }; c.L[0] = new X { O = o7 }; c.M[0] = new X { O = o8 }; c.LL.Add(new X { O = o14 }); c.ML.Add(new X { O = o15 }); var m = InitializeModel(c); _hasConstructorRun = false; Create(m); StateFormulas.ShouldBeEmpty(); RootComponents.Length.ShouldBe(1); var root = RootComponents[0]; root.ShouldBeOfType <C>(); c = (C)root; c.E.X.O.Y.ShouldBe(0); c.E.Null.ShouldBe(null); c.F.O.Y.ShouldBe(1); c.G[0].O.Y.ShouldBe(2); c.H[0].O.Y.ShouldBe(3); c.I[0].O.Y.ShouldBe(4); c.J[0].O.Y.ShouldBe(5); c.K[0].O.Y.ShouldBe(6); c.L[0].O.Y.ShouldBe(7); c.M[0].O.Y.ShouldBe(8); c.GL[0].O.Y.ShouldBe(9); c.HL[0].O.Y.ShouldBe(10); c.IL[0].O.Y.ShouldBe(11); c.JL[0].O.Y.ShouldBe(12); c.KL[0].O.Y.ShouldBe(13); c.LL[0].O.Y.ShouldBe(14); c.ML[0].O.Y.ShouldBe(15); root.GetSubcomponents().ShouldBeEmpty(); _hasConstructorRun.ShouldBe(false); }