Beispiel #1
0
        public void TestBigBuffer()
        {
            Lifetime.Using(lifetime =>
            {
                SynchronousScheduler.Instance.SetActive(lifetime);
                var serverProtocol = Server(lifetime);
                var clientProtocol = Client(lifetime, serverProtocol);

                var sp = new RdProperty <string>().Static(1);
                sp.Bind(lifetime, serverProtocol, Top);
                var cp = new RdProperty <string>().Static(1);
                cp.Bind(lifetime, clientProtocol, Top);

                cp.SetValue("1");
                WaitAndAssert(sp, "1");

                sp.SetValue(new string('a', 100000));
                WaitAndAssert(cp, new string('a', 100000), "1");

                cp.SetValue("a");
                WaitAndAssert(sp, "a", new string('a', 100000));

                cp.SetValue("ab");
                WaitAndAssert(sp, "ab", "a");

                cp.SetValue("abc");
                WaitAndAssert(sp, "abc", "ab");
            });
        }
Beispiel #2
0
        //primary constructor
        private Solution2(
            [NotNull] RdCall <int, MyClass> get,
            [NotNull] RdProperty <string> version,
            [NotNull] RdProperty <RdDocumentModel> testBuffer
            )
        {
            if (get == null)
            {
                throw new ArgumentNullException("get");
            }
            if (version == null)
            {
                throw new ArgumentNullException("version");
            }
            if (testBuffer == null)
            {
                throw new ArgumentNullException("testBuffer");
            }

            _Get                    = get;
            _Version                = version;
            _TestBuffer             = testBuffer;
            _Version.OptimizeNested = true;
            _Version.ValueCanBeNull = true;
            BindableChildren.Add(new KeyValuePair <string, object>("get", _Get));
            BindableChildren.Add(new KeyValuePair <string, object>("version", _Version));
            BindableChildren.Add(new KeyValuePair <string, object>("testBuffer", _TestBuffer));
        }
Beispiel #3
0
        public void TestRunWithSlowpokeServer()
        {
            Lifetime.Using(lifetime =>
            {
                SynchronousScheduler.Instance.SetActive(lifetime);

                var port           = FindFreePort();
                var clientProtocol = Client(lifetime, port);

                var cp = new RdProperty <int>().Static(1);
                cp.Bind(lifetime, clientProtocol, Top);
                cp.SetValue(1);

                Thread.Sleep(2000);
                var serverProtocol = Server(lifetime, port);
                var sp             = new RdProperty <int>().Static(1);
                sp.Bind(lifetime, serverProtocol, Top);

                var prev = sp.Maybe;


                cp.SetValue(4);
                Thread.Sleep(200);
                WaitAndAssert(sp, 4, prev);
            });
        }
Beispiel #4
0
        public void TestOrdering()
        {
            Lifetime.Using(lifetime =>
            {
                SynchronousScheduler.Instance.SetActive(lifetime);
                var serverProtocol = Server(lifetime);
                var clientProtocol = Client(lifetime, serverProtocol);

                var sp = new RdProperty <int>().Static(1);
                sp.Bind(lifetime, serverProtocol, Top);
                var cp = new RdProperty <int>().Static(1);
                cp.Bind(lifetime, clientProtocol, Top);

                var log = new List <int>();
                sp.Advise(lifetime, it => log.Add(it));
                sp.SetValue(1);
                sp.SetValue(2);
                sp.SetValue(3);
                sp.SetValue(4);
                sp.SetValue(5);

                while (log.Count < 5)
                {
                    Thread.Sleep(10);
                }
                CollectionAssert.AreEqual(new[] { 1, 2, 3, 4, 5 }, log);
            });
        }
        //primary constructor
        private HotReloadPluginModel(
            [NotNull] RdSignal <SavedDocument> reload,
            [NotNull] RdSignal <bool> enable,
            [NotNull] RdProperty <bool> isEnabled,
            [NotNull] RdSignal <MessageInfo> showMessage
            )
        {
            if (reload == null)
            {
                throw new ArgumentNullException("reload");
            }
            if (enable == null)
            {
                throw new ArgumentNullException("enable");
            }
            if (isEnabled == null)
            {
                throw new ArgumentNullException("isEnabled");
            }
            if (showMessage == null)
            {
                throw new ArgumentNullException("showMessage");
            }

            _Reload      = reload;
            _Enable      = enable;
            _IsEnabled   = isEnabled;
            _ShowMessage = showMessage;
            _IsEnabled.OptimizeNested = true;
            BindableChildren.Add(new KeyValuePair <string, object>("reload", _Reload));
            BindableChildren.Add(new KeyValuePair <string, object>("enable", _Enable));
            BindableChildren.Add(new KeyValuePair <string, object>("isEnabled", _IsEnabled));
            BindableChildren.Add(new KeyValuePair <string, object>("showMessage", _ShowMessage));
        }
Beispiel #6
0
        //primary constructor
        private InterningExtRootModel(
            [NotNull] RdProperty <string> internedLocally,
            [NotNull] RdProperty <string> internedExternally,
            [NotNull] RdProperty <string> internedInProtocol
            )
        {
            if (internedLocally == null)
            {
                throw new ArgumentNullException("internedLocally");
            }
            if (internedExternally == null)
            {
                throw new ArgumentNullException("internedExternally");
            }
            if (internedInProtocol == null)
            {
                throw new ArgumentNullException("internedInProtocol");
            }

            _InternedLocally                   = internedLocally;
            _InternedExternally                = internedExternally;
            _InternedInProtocol                = internedInProtocol;
            _InternedLocally.OptimizeNested    = true;
            _InternedExternally.OptimizeNested = true;
            _InternedInProtocol.OptimizeNested = true;
            BindableChildren.Add(new KeyValuePair <string, object>("internedLocally", _InternedLocally));
            BindableChildren.Add(new KeyValuePair <string, object>("internedExternally", _InternedExternally));
            BindableChildren.Add(new KeyValuePair <string, object>("internedInProtocol", _InternedInProtocol));
        }
Beispiel #7
0
        public void TestReconnect()
        {
            Lifetime.Using(lifetime =>
            {
                SynchronousScheduler.Instance.SetActive(lifetime);
                var serverProtocol = Server(lifetime, null);

                var sp = new RdProperty <int>().Static(1);
                sp.Bind(lifetime, serverProtocol, Top);
                sp.IsMaster = false;

                var wire        = serverProtocol.Wire as SocketWire.Base;
                int clientCount = 0;
                wire.NotNull().Connected.WhenTrue(lifetime, _ =>
                {
                    clientCount++;
                });

                Assert.AreEqual(0, clientCount);

                Lifetime.Using(lf =>
                {
                    var clientProtocol = Client(lf, serverProtocol);
                    var cp             = new RdProperty <int>().Static(1);
                    cp.IsMaster        = true;
                    cp.Bind(lf, clientProtocol, Top);
                    cp.SetValue(1);
                    WaitAndAssert(sp, 1);
                    Assert.AreEqual(1, clientCount);
                });


                Lifetime.Using(lf =>
                {
                    sp = new RdProperty <int>().Static(2);
                    sp.Bind(lifetime, serverProtocol, Top);

                    var clientProtocol = Client(lf, serverProtocol);
                    var cp             = new RdProperty <int>().Static(2);
                    cp.Bind(lf, clientProtocol, Top);
                    cp.SetValue(2);
                    WaitAndAssert(sp, 2);
                    Assert.AreEqual(2, clientCount);
                });


                Lifetime.Using(lf =>
                {
                    var clientProtocol = Client(lf, serverProtocol);
                    var cp             = new RdProperty <int>().Static(2);
                    cp.Bind(lf, clientProtocol, Top);
                    cp.SetValue(3);
                    WaitAndAssert(sp, 3, 2);
                    Assert.AreEqual(3, clientCount);
                });
            });
        }
Beispiel #8
0
        //fields
        //public fields

        //private fields
        //primary constructor
        private OpenClass_Unknown(
            [NotNull] RdProperty <string> @string,
            [NotNull] string field
            ) : base(
                @string,
                field
                )
        {
        }
Beispiel #9
0
        public void TestNestedInterning()
        {
            ServerProtocol.Serializers.Register(InterningNestedTestModel.Read, InterningNestedTestModel.Write);
            ClientProtocol.Serializers.Register(InterningNestedTestModel.Read, InterningNestedTestModel.Write);

            var serverProperty =
                new RdProperty <InterningNestedTestModel>(InterningNestedTestModel.Read.Interned("Test"), InterningNestedTestModel.Write.Interned("Test"))
            {
                IsMaster = true
            }
            .Static(1);
            var clientProperty =
                new RdProperty <InterningNestedTestModel>(InterningNestedTestModel.Read.Interned("Test"), InterningNestedTestModel.Write.Interned("Test"))
            {
                IsMaster = false
            }
            .Static(1);
            var serverPropertyWrapper = new InterningTestPropertyWrapper <InterningNestedTestModel>(serverProperty, ServerProtocol.SerializationContext);
            var clientPropertyWrapper = new InterningTestPropertyWrapper <InterningNestedTestModel>(clientProperty, ClientProtocol.SerializationContext);

            serverPropertyWrapper.mySerializationContext =
                ServerProtocol.SerializationContext.WithInternRootsHere(serverPropertyWrapper, "Test");
            clientPropertyWrapper.mySerializationContext =
                ClientProtocol.SerializationContext.WithInternRootsHere(clientPropertyWrapper, "Test");


            serverPropertyWrapper.Bind(LifetimeDefinition.Lifetime, ServerProtocol, "top");
            clientPropertyWrapper.Bind(LifetimeDefinition.Lifetime, ClientProtocol, "top");

            var testValue = new InterningNestedTestModel("extremelyLongString",
                                                         new InterningNestedTestModel("middle", new InterningNestedTestModel("bottom", null)));

            var firstSendBytes = MeasureBytes(ServerProtocol, () =>
            {
                serverProperty.Value = testValue;
                Assertion.Assert(Equals(testValue, clientProperty.Value), "Received value should be the same as sent one");
            });

            var secondSendBytes = MeasureBytes(ServerProtocol, () =>
            {
                serverProperty.Value = testValue.Inner;
                Assertion.Assert(Equals(testValue.Inner, clientProperty.Value),
                                 "Received value should be the same as sent one");
            });

            var thirdSendBytes = MeasureBytes(ServerProtocol, () =>
            {
                serverProperty.Value = testValue;
                Assertion.Assert(Equals(testValue, clientProperty.Value), "Received value should be the same as sent one");
            });

            Assertion.Assert(secondSendBytes == thirdSendBytes,
                             "Sending a single interned object should take the same amount of bytes");
            Assertion.Assert(thirdSendBytes <= firstSendBytes - SumLengths(testValue), "Interning should save data");
        }
Beispiel #10
0
        //primary constructor
        private InterningExt(
            [NotNull] RdProperty <InterningExtRootModel> root
            )
        {
            if (root == null)
            {
                throw new ArgumentNullException("root");
            }

            _Root = root;
            BindableChildren.Add(new KeyValuePair <string, object>("root", _Root));
        }
Beispiel #11
0
 public void TestClientWithoutServerWithDelayAndMessages()
 {
     Lifetime.Using(lifetime =>
     {
         SynchronousScheduler.Instance.SetActive(lifetime);
         var protocol = Client(lifetime, FindFreePort());
         Thread.Sleep(100);
         var p = new RdProperty <int>().Static(1);
         p.Bind(lifetime, protocol, Top);
         p.SetValue(1);
         p.SetValue(2);
         Thread.Sleep(50);
     });
 }
Beispiel #12
0
        private void WaitAndAssert <T>(RdProperty <T> property, T expected, Maybe <T> prev = default(Maybe <T>))
        {
            var       start   = Environment.TickCount;
            const int timeout = 5000;

            while (Environment.TickCount - start < timeout && property.Maybe == prev)
            {
                Thread.Sleep(10);
            }
            if (property.Maybe == prev)
            {
                throw new TimeoutException($"Timeout {timeout} ms while waiting for value '{expected}'");
            }
            Assert.AreEqual(expected, property.Value);
        }
Beispiel #13
0
        public void TestBasicRun()
        {
            Lifetime.Using(lifetime =>
            {
                SynchronousScheduler.Instance.SetActive(lifetime);
                var serverProtocol = Server(lifetime);
                var clientProtocol = Client(lifetime, serverProtocol);

                var sp = new RdProperty <int>().Static(1);
                sp.Bind(lifetime, serverProtocol, Top);
                var cp = new RdProperty <int>().Static(1);
                cp.Bind(lifetime, clientProtocol, Top);

                cp.SetValue(1);
                WaitAndAssert(sp, 1);
            });
        }
        //primary constructor
        private SummonerModel(
            [NotNull] RdProperty <string> myString,
            [NotNull] RdProperty <bool> myBool,
            [NotNull] RdProperty <JetBrains.Rider.Model.MyEnum?> myEnum,
            [NotNull] RdMap <string, string> data,
            [NotNull] RdSignal <JetBrains.Rider.Model.MyStructure> myStructure
            )
        {
            if (myString == null)
            {
                throw new ArgumentNullException("myString");
            }
            if (myBool == null)
            {
                throw new ArgumentNullException("myBool");
            }
            if (myEnum == null)
            {
                throw new ArgumentNullException("myEnum");
            }
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }
            if (myStructure == null)
            {
                throw new ArgumentNullException("myStructure");
            }

            _MyString                = myString;
            _MyBool                  = myBool;
            _MyEnum                  = myEnum;
            _Data                    = data;
            _MyStructure             = myStructure;
            _MyString.OptimizeNested = true;
            _MyBool.OptimizeNested   = true;
            _MyEnum.OptimizeNested   = true;
            _Data.OptimizeNested     = true;
            _MyEnum.ValueCanBeNull   = true;
            BindableChildren.Add(new KeyValuePair <string, object>("myString", _MyString));
            BindableChildren.Add(new KeyValuePair <string, object>("myBool", _MyBool));
            BindableChildren.Add(new KeyValuePair <string, object>("myEnum", _MyEnum));
            BindableChildren.Add(new KeyValuePair <string, object>("data", _Data));
            BindableChildren.Add(new KeyValuePair <string, object>("myStructure", _MyStructure));
        }
Beispiel #15
0
        //primary constructor
        private Solution2(
            [NotNull] RdCall <int, MyClass> get,
            [NotNull] RdProperty <RdDocumentModel> testBuffer
            )
        {
            if (get == null)
            {
                throw new ArgumentNullException("get");
            }
            if (testBuffer == null)
            {
                throw new ArgumentNullException("testBuffer");
            }

            _Get        = get;
            _TestBuffer = testBuffer;
            BindableChildren.Add(new KeyValuePair <string, object>("get", _Get));
            BindableChildren.Add(new KeyValuePair <string, object>("testBuffer", _TestBuffer));
        }
Beispiel #16
0
        //primary constructor
        protected OpenClass(
            [NotNull] RdProperty <string> @string,
            [NotNull] string field
            )
        {
            if (@string == null)
            {
                throw new ArgumentNullException("string");
            }
            if (field == null)
            {
                throw new ArgumentNullException("field");
            }

            _String = @string;
            Field   = field;
            _String.OptimizeNested = true;
            BindableChildren.Add(new KeyValuePair <string, object>("string", _String));
        }
Beispiel #17
0
        //primary constructor
        private RefExt(
            [NotNull] RdProperty <Base> @struct,
            [NotNull] RdProperty <OpenClass> openModel
            )
        {
            if (@struct == null)
            {
                throw new ArgumentNullException("struct");
            }
            if (openModel == null)
            {
                throw new ArgumentNullException("openModel");
            }

            _Struct                = @struct;
            _OpenModel             = openModel;
            _Struct.OptimizeNested = true;
            BindableChildren.Add(new KeyValuePair <string, object>("struct", _Struct));
            BindableChildren.Add(new KeyValuePair <string, object>("openModel", _OpenModel));
        }
Beispiel #18
0
        //primary constructor
        private RdTextBufferState(
            [NotNull] RdProperty <RdTextBufferChange> changes,
            [NotNull] RdProperty <TextBufferVersion> versionBeforeTypingSession,
            [NotNull] RdProperty <RdAssertion> assertedMasterText,
            [NotNull] RdProperty <RdAssertion> assertedSlaveText
            )
        {
            if (changes == null)
            {
                throw new ArgumentNullException("changes");
            }
            if (versionBeforeTypingSession == null)
            {
                throw new ArgumentNullException("versionBeforeTypingSession");
            }
            if (assertedMasterText == null)
            {
                throw new ArgumentNullException("assertedMasterText");
            }
            if (assertedSlaveText == null)
            {
                throw new ArgumentNullException("assertedSlaveText");
            }

            _Changes = changes;
            _VersionBeforeTypingSession = versionBeforeTypingSession;
            _AssertedMasterText         = assertedMasterText;
            _AssertedSlaveText          = assertedSlaveText;
            _Changes.OptimizeNested     = true;
            _VersionBeforeTypingSession.OptimizeNested = true;
            _AssertedMasterText.OptimizeNested         = true;
            _AssertedSlaveText.OptimizeNested          = true;
            _Changes.ValueCanBeNull = true;
            BindableChildren.Add(new KeyValuePair <string, object>("changes", _Changes));
            BindableChildren.Add(new KeyValuePair <string, object>("versionBeforeTypingSession", _VersionBeforeTypingSession));
            BindableChildren.Add(new KeyValuePair <string, object>("assertedMasterText", _AssertedMasterText));
            BindableChildren.Add(new KeyValuePair <string, object>("assertedSlaveText", _AssertedSlaveText));
        }
Beispiel #19
0
        //primary constructor
        private RdOtState(
            [NotNull] RdProperty <OtOperation> operation,
            [NotNull] RdSignal <RdAck> ack,
            [NotNull] RdProperty <RdAssertion> assertedMasterText,
            [NotNull] RdProperty <RdAssertion> assertedSlaveText
            )
        {
            if (operation == null)
            {
                throw new ArgumentNullException("operation");
            }
            if (ack == null)
            {
                throw new ArgumentNullException("ack");
            }
            if (assertedMasterText == null)
            {
                throw new ArgumentNullException("assertedMasterText");
            }
            if (assertedSlaveText == null)
            {
                throw new ArgumentNullException("assertedSlaveText");
            }

            _Operation                         = operation;
            _Ack                               = ack;
            _AssertedMasterText                = assertedMasterText;
            _AssertedSlaveText                 = assertedSlaveText;
            _Operation.OptimizeNested          = true;
            _AssertedMasterText.OptimizeNested = true;
            _AssertedSlaveText.OptimizeNested  = true;
            _Operation.ValueCanBeNull          = true;
            BindableChildren.Add(new KeyValuePair <string, object>("operation", _Operation));
            BindableChildren.Add(new KeyValuePair <string, object>("ack", _Ack));
            BindableChildren.Add(new KeyValuePair <string, object>("assertedMasterText", _AssertedMasterText));
            BindableChildren.Add(new KeyValuePair <string, object>("assertedSlaveText", _AssertedSlaveText));
        }
Beispiel #20
0
 public Model()
 {
     myValue = new RdProperty <int>();
 }
Beispiel #21
0
        private void DoTest(bool firstClient, bool secondClient, bool thenSwitchSides = false)
        {
            var serverProperty =
                new RdProperty <InterningTestModel>(InterningTestModel.Read, InterningTestModel.Write)
            {
                IsMaster = true
            }
            .Static(1);
            var clientProperty =
                new RdProperty <InterningTestModel>(InterningTestModel.Read, InterningTestModel.Write)
            {
                IsMaster = false
            }
            .Static(1);
            var serverPropertyWrapper = new InterningTestPropertyWrapper <InterningTestModel>(serverProperty, ServerProtocol.SerializationContext);
            var clientPropertyWrapper = new InterningTestPropertyWrapper <InterningTestModel>(clientProperty, ClientProtocol.SerializationContext);

            serverPropertyWrapper.mySerializationContext =
                ServerProtocol.SerializationContext.WithInternRootsHere(serverPropertyWrapper, "Test");
            clientPropertyWrapper.mySerializationContext =
                ClientProtocol.SerializationContext.WithInternRootsHere(clientPropertyWrapper, "Test");


            serverPropertyWrapper.Bind(LifetimeDefinition.Lifetime, ServerProtocol, "top");
            clientPropertyWrapper.Bind(LifetimeDefinition.Lifetime, ClientProtocol, "top");

            var serverModel = new InterningTestModel("");

            serverProperty.Value = serverModel;
            var clientModel = clientProperty.Value;

            var simpleTestData = new List <(int, string)> {
                (0, ""), (1, "test"), (2, "why")
            };

            var firstSenderProtocol = firstClient ? ClientProtocol : ServerProtocol;
            var firstSenderModel    = firstClient ? clientModel : serverModel;

            var firstBytesWritten = MeasureBytes(firstSenderProtocol, () =>
            {
                foreach (var pair in simpleTestData)
                {
                    firstSenderModel.Issues[pair.Item1] = new WrappedStringModel(pair.Item2);
                }
            });

            var secondSenderProtocol = secondClient ? ClientProtocol : ServerProtocol;
            var secondSenderModel    = secondClient ? clientModel : serverModel;

            var secondBytesWritten = MeasureBytes(secondSenderProtocol, () =>
            {
                foreach (var pair in simpleTestData)
                {
                    secondSenderModel.Issues[pair.Item1 + simpleTestData.Count] = new WrappedStringModel(pair.Item2);
                }
            });

            Assertion.Assert(firstBytesWritten - simpleTestData.Sum(it => it.Item2.Length) >= secondBytesWritten,
                             "Interning must save bytes");

            var firstReceiver  = firstClient ? serverModel : clientModel;
            var secondReceiver = secondClient ? serverModel : clientModel;

            foreach (var pair in simpleTestData)
            {
                Assertion.Assert(pair.Item2 == firstReceiver.Issues[pair.Item1].Text, "Data must match");
                Assertion.Assert(pair.Item2 == secondReceiver.Issues[pair.Item1 + simpleTestData.Count].Text,
                                 "Data must match");
            }

            if (!thenSwitchSides)
            {
                return;
            }

            var extraString = "again";

            var thirdBytesWritten = MeasureBytes(secondSenderProtocol, () =>
            {
                foreach (var pair in simpleTestData)
                {
                    secondSenderModel.Issues[pair.Item1 + simpleTestData.Count * 2] =
                        new WrappedStringModel(pair.Item2 + extraString);
                }
            });

            var fourthBytesWritten = MeasureBytes(firstSenderProtocol, () =>
            {
                foreach (var pair in simpleTestData)
                {
                    firstSenderModel.Issues[pair.Item1 + simpleTestData.Count * 3] =
                        new WrappedStringModel(pair.Item2 + extraString);
                }
            });

            Assertion.Assert(thirdBytesWritten - simpleTestData.Sum(it => it.Item2.Length + extraString.Length) >=
                             fourthBytesWritten, "Interning must save bytes");

            foreach (var pair in simpleTestData)
            {
                Assertion.Assert(pair.Item2 + extraString == secondReceiver.Issues[pair.Item1 + simpleTestData.Count * 2].Text,
                                 "Data must match");
                Assertion.Assert(pair.Item2 + extraString == firstReceiver.Issues[pair.Item1 + simpleTestData.Count * 3].Text,
                                 "Data must match");
            }
        }
Beispiel #22
0
 public static void Write(SerializationCtx ctx, UnsafeWriter writer, object value)
 {
     RdProperty <int> .Write(ctx, writer, ((Model)value).myValue);
 }
Beispiel #23
0
            public static Model Read(SerializationCtx ctx, UnsafeReader reader)
            {
                var modelProperty = RdProperty <int> .Read(ctx, reader);

                return(new Model(modelProperty));
            }
Beispiel #24
0
 private Model(RdProperty <int> modelProperty)
 {
     myValue = modelProperty;
 }
Beispiel #25
0
 public InterningTestPropertyWrapper(RdProperty <T> property, SerializationCtx serializationContext)
 {
     Property = property;
     mySerializationContext = serializationContext;
 }
        //primary constructor
        private UnityModel(
            [NotNull] RdProperty <bool> play,
            [NotNull] RdProperty <bool> pause,
            [NotNull] RdEndpoint <RdVoid, RdVoid> step,
            [NotNull] RdProperty <string> unityPluginVersion,
            [NotNull] RdProperty <int> riderProcessId,
            [NotNull] RdProperty <string> applicationPath,
            [NotNull] RdProperty <string> applicationVersion,
            [NotNull] RdProperty <UnityLogModelInitialized> logModelInitialized,
            [NotNull] RdCall <RdVoid, bool> isBackendConnected,
            [NotNull] RdEndpoint <RdVoid, UnityEditorState> getUnityEditorState,
            [NotNull] RdCall <RdOpenFileArgs, bool> openFileLineCol,
            [NotNull] RdEndpoint <string, bool> updateUnityPlugin,
            [NotNull] RdEndpoint <bool, RdVoid> refresh,
            [NotNull] RdProperty <JetBrains.Platform.Unity.Model.UnitTestLaunch> unitTestLaunch
            )
        {
            if (play == null)
            {
                throw new ArgumentNullException("play");
            }
            if (pause == null)
            {
                throw new ArgumentNullException("pause");
            }
            if (step == null)
            {
                throw new ArgumentNullException("step");
            }
            if (unityPluginVersion == null)
            {
                throw new ArgumentNullException("unityPluginVersion");
            }
            if (riderProcessId == null)
            {
                throw new ArgumentNullException("riderProcessId");
            }
            if (applicationPath == null)
            {
                throw new ArgumentNullException("applicationPath");
            }
            if (applicationVersion == null)
            {
                throw new ArgumentNullException("applicationVersion");
            }
            if (logModelInitialized == null)
            {
                throw new ArgumentNullException("logModelInitialized");
            }
            if (isBackendConnected == null)
            {
                throw new ArgumentNullException("isBackendConnected");
            }
            if (getUnityEditorState == null)
            {
                throw new ArgumentNullException("getUnityEditorState");
            }
            if (openFileLineCol == null)
            {
                throw new ArgumentNullException("openFileLineCol");
            }
            if (updateUnityPlugin == null)
            {
                throw new ArgumentNullException("updateUnityPlugin");
            }
            if (refresh == null)
            {
                throw new ArgumentNullException("refresh");
            }
            if (unitTestLaunch == null)
            {
                throw new ArgumentNullException("unitTestLaunch");
            }

            _Play  = play;
            _Pause = pause;
            _Step  = step;
            _UnityPluginVersion   = unityPluginVersion;
            _RiderProcessId       = riderProcessId;
            _ApplicationPath      = applicationPath;
            _ApplicationVersion   = applicationVersion;
            _LogModelInitialized  = logModelInitialized;
            _IsBackendConnected   = isBackendConnected;
            _GetUnityEditorState  = getUnityEditorState;
            _OpenFileLineCol      = openFileLineCol;
            _UpdateUnityPlugin    = updateUnityPlugin;
            _Refresh              = refresh;
            _UnitTestLaunch       = unitTestLaunch;
            _Play.OptimizeNested  = true;
            _Pause.OptimizeNested = true;
            _UnityPluginVersion.OptimizeNested = true;
            _RiderProcessId.OptimizeNested     = true;
            _ApplicationPath.OptimizeNested    = true;
            _ApplicationVersion.OptimizeNested = true;
            BindableChildren.Add(new KeyValuePair <string, object>("play", _Play));
            BindableChildren.Add(new KeyValuePair <string, object>("pause", _Pause));
            BindableChildren.Add(new KeyValuePair <string, object>("step", _Step));
            BindableChildren.Add(new KeyValuePair <string, object>("unityPluginVersion", _UnityPluginVersion));
            BindableChildren.Add(new KeyValuePair <string, object>("riderProcessId", _RiderProcessId));
            BindableChildren.Add(new KeyValuePair <string, object>("applicationPath", _ApplicationPath));
            BindableChildren.Add(new KeyValuePair <string, object>("applicationVersion", _ApplicationVersion));
            BindableChildren.Add(new KeyValuePair <string, object>("logModelInitialized", _LogModelInitialized));
            BindableChildren.Add(new KeyValuePair <string, object>("isBackendConnected", _IsBackendConnected));
            BindableChildren.Add(new KeyValuePair <string, object>("getUnityEditorState", _GetUnityEditorState));
            BindableChildren.Add(new KeyValuePair <string, object>("openFileLineCol", _OpenFileLineCol));
            BindableChildren.Add(new KeyValuePair <string, object>("updateUnityPlugin", _UpdateUnityPlugin));
            BindableChildren.Add(new KeyValuePair <string, object>("refresh", _Refresh));
            BindableChildren.Add(new KeyValuePair <string, object>("unitTestLaunch", _UnitTestLaunch));
        }
        //primary constructor
        public UnityModel(
            [NotNull] RdProperty <bool> play,
            [NotNull] RdProperty <bool> pause,
            [NotNull] RdCall <RdVoid, RdVoid> step,
            [NotNull] RdProperty <string> unityPluginVersion,
            [NotNull] RdProperty <int> riderProcessId,
            [NotNull] RdProperty <string> applicationPath,
            [NotNull] RdProperty <string> applicationVersion,
            [NotNull] RdProperty <UnityLogModelInitialized> logModelInitialized,
            [NotNull] RdEndpoint <RdVoid, bool> isClientConnected,
            [NotNull] RdEndpoint <RdOpenFileArgs, bool> openFileLineCol,
            [NotNull] RdCall <string, bool> updateUnityPlugin,
            [NotNull] RdCall <RdVoid, RdVoid> refresh
            )
        {
            if (play == null)
            {
                throw new ArgumentNullException("play");
            }
            if (pause == null)
            {
                throw new ArgumentNullException("pause");
            }
            if (step == null)
            {
                throw new ArgumentNullException("step");
            }
            if (unityPluginVersion == null)
            {
                throw new ArgumentNullException("unityPluginVersion");
            }
            if (riderProcessId == null)
            {
                throw new ArgumentNullException("riderProcessId");
            }
            if (applicationPath == null)
            {
                throw new ArgumentNullException("applicationPath");
            }
            if (applicationVersion == null)
            {
                throw new ArgumentNullException("applicationVersion");
            }
            if (logModelInitialized == null)
            {
                throw new ArgumentNullException("logModelInitialized");
            }
            if (isClientConnected == null)
            {
                throw new ArgumentNullException("isClientConnected");
            }
            if (openFileLineCol == null)
            {
                throw new ArgumentNullException("openFileLineCol");
            }
            if (updateUnityPlugin == null)
            {
                throw new ArgumentNullException("updateUnityPlugin");
            }
            if (refresh == null)
            {
                throw new ArgumentNullException("refresh");
            }

            _Play  = play;
            _Pause = pause;
            _Step  = step;
            _UnityPluginVersion   = unityPluginVersion;
            _RiderProcessId       = riderProcessId;
            _ApplicationPath      = applicationPath;
            _ApplicationVersion   = applicationVersion;
            _LogModelInitialized  = logModelInitialized;
            _IsClientConnected    = isClientConnected;
            _OpenFileLineCol      = openFileLineCol;
            _UpdateUnityPlugin    = updateUnityPlugin;
            _Refresh              = refresh;
            _Play.OptimizeNested  = true;
            _Pause.OptimizeNested = true;
            _UnityPluginVersion.OptimizeNested = true;
            _RiderProcessId.OptimizeNested     = true;
            _ApplicationPath.OptimizeNested    = true;
            _ApplicationVersion.OptimizeNested = true;
        }
Beispiel #28
0
 private void WaitAndAssert <T>(RdProperty <T> property, T expected, T prev)
 {
     WaitAndAssert(property, expected, new Maybe <T>(prev));
 }