// This method gets called by the runtime. Use this method to configure the HTTP request pipeline
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();

                var context = app.ApplicationServices.GetService <DataContext>();
                TestDataClass.AddTestData(context);
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }
            app.UseApplicationInsightsRequestTelemetry();
            app.UseApplicationInsightsExceptionTelemetry();
            app.UseCors(x => x.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin().AllowCredentials());
            app.UseStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");

                routes.MapRoute(
                    name: "services",
                    template: "services/{controller=articles}/{id?}");

                routes.MapSpaFallbackRoute(
                    name: "spa-fallback",
                    defaults: new { controller = "Home", action = "Index" });
            });
        }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.F1))
        {
            TestDataClass tdc = new TestDataClass(
                "MyName", "This is a serialised item");
            XmlSerializer x = new XmlSerializer(tdc.GetType());

            System.IO.FileStream file = System.IO.File.Create("TestFile.xml");

            x.Serialize(file, tdc);
            file.Close();
        }

        if (Input.GetKeyDown(KeyCode.F2))
        {
            TestDataClass tdc = new TestDataClass("", "");
            XmlSerializer x   = new XmlSerializer(tdc.GetType());

            System.IO.FileStream file = System.IO.File.OpenRead("TestFile.xml");

            tdc = (TestDataClass)x.Deserialize(file);
            file.Close();
            print(tdc.name + ": " + tdc.description);
        }
    }
        private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <object> result)
        {
            var activity = await result as Activity;

            // An example of a string value saved directly to UserData
            context.UserData.SetValue("test", "test");

            // If we have not asked the user their name, ask it now
            var askedName = context.UserData.GetValueOrDefault <bool>(AskedNameProperty);

            if (!askedName)
            {
                await context.PostAsync($"Hi.  What is your name?");

                // We've asked the user their name, so persist the information in UserData
                context.UserData.SetValue(AskedNameProperty, true);
            }
            else
            {
                // Check if we have saved GreetingState.  If we have not, assume the text is the user's Name in
                // answer to the query above.
                var greetingState = context.UserData.GetValueOrDefault <GreetingState>(GreetingStateProperty);
                if (greetingState == null)
                {
                    greetingState = new GreetingState()
                    {
                        Name = activity.Text
                    };
                    context.UserData.SetValue(GreetingStateProperty, greetingState);

                    await context.PostAsync($"Hi {greetingState.Name}.  What city do you live in?");
                }
                else if (string.IsNullOrEmpty(greetingState.City))
                {
                    // Since greetingState.City is empty, assume the text is the user's City in response
                    // to the query above
                    greetingState.City = activity.Text;
                    context.UserData.SetValue(GreetingStateProperty, greetingState);

                    await context.PostAsync($"Ok {greetingState.Name}.  I've got your City of residence as {greetingState.City}");

                    // Save some random data
                    var classToSave = new TestDataClass()
                    {
                        TestIntField    = 9,
                        TestStringField = Guid.NewGuid().ToString(),
                        TestTuple       = new Tuple <string, string>("item 1", "item 2")
                    };
                    context.UserData.SetValue(TestDataClassProperty, classToSave);
                }
                else
                {
                    int length = (activity.Text ?? string.Empty).Length;
                    // Return our reply to the user
                    await context.PostAsync($"Hi {greetingState.Name} from {greetingState.City}.  You sent {activity.Text} which was {length} characters");
                }
            }

            context.Wait(MessageReceivedAsync);
        }
        public void ParseString_HasIntField_ReturnsTestDataClassWithInt()
        {
            string parseSource = "     2         ";

            TestDataClass testData = ParseTestData(parseSource);

            testData.IntColumn.ShouldBe(2);
        }
        public void ParseString_HasStringField_ReturnsTestDataClassWithString()
        {
            string parseSource = "One            ";

            TestDataClass testData = ParseTestData(parseSource);

            testData.StringColumn.ShouldBe("One");
        }
        public void ParseString_HasAllFields_ReturnsObject()
        {
            string parseSource = "";

            TestDataClass testData = ParseTestData(parseSource);

            testData.ShouldNotBeNull();
        }
Exemple #7
0
        public void Test()
        {
            var testData = new TestDataClass {
                Data = DateTime.Today.ToString(CultureInfo.InvariantCulture)
            };

            WorkflowSdkClient.Start <TestDataClass, TestStep>(testData, workflow => { });
        }
        public void ParseString_HasDecimalField_ReturnsTestDataClassWithDecimal()
        {
            string parseSource = "          3.33 ";

            TestDataClass testData = ParseTestData(parseSource);

            testData.DecimalColumn.ShouldBe <decimal>(3.33m);
        }
        public void ParseString_WithThatIsTooLong_ReturnsParsedObject()
        {
            string parseSource = "One  2    3.33                      ";

            TestDataClass testData = ParseTestData(parseSource);

            testData.StringColumn.ShouldBe("One");
            testData.IntColumn.ShouldBe(2);
        }
        public void ParseString_WithAllThreeColumnTypes_ReturnsParsedObject()
        {
            string parseSource = "One  2    3.33 ";

            TestDataClass testData = ParseTestData(parseSource);

            testData.StringColumn.ShouldBe("One");
            testData.IntColumn.ShouldBe(2);
            testData.DecimalColumn.ShouldBe <decimal>(3.33m);
        }
Exemple #11
0
    void OnTestListUpdated(SyncList <TestDataClass> .Operation op, int index, TestDataClass oldItem, TestDataClass newItem)
    {
        string output = "";

        foreach (TestDataClass i in testList)
        {
            output += i + " ";
        }
        Debug.Log(output);
    }
Exemple #12
0
        public void TestCopyPropertiesIntoNew()
        {
            var data = new TestDataClass
            {
                Data = "test"
            };
            var newData = data.CopyPropertiesIntoNew();

            Assert.NotSame(data, newData);
            Assert.Equal(data.Data, newData.Data);
        }
        public void PropagateToDataClass(bool simulateDbNull)
        {
            TestDataHelper <TestDataClass, TestDataClass> info = new(simulateDbNull : simulateDbNull, useConverter : false);
            DynamicMethodModelFactory         modelFactory     = new(info.DatabaseMapper);
            Func <IDataReader, TestDataClass> factory          = modelFactory.GetFactory <TestDataClass>(info.DataReader);

            TestDataClass actual   = factory(info.DataReader);
            TestDataClass expected = simulateDbNull
                ? TestDataClass.CreateWithNulledProperties()
                : TestDataClass.CreateWithDbValuesProperties();

            actual.Should().BeEquivalentTo(expected);
        }
Exemple #14
0
        public void TestCopyPropertiesFilter()
        {
            var data = new TestDataClass
            {
                Data  = "test",
                Data2 = "test2"
            };
            var newData = new TestDataClass();

            Assert.NotEqual(data.Data, newData.Data);
            Assert.NotEqual(data.Data2, newData.Data2);
            data.CopyPropertiesInto(newData, (from, to) => from.Name == "Data");
            Assert.Equal(data.Data, newData.Data);
            Assert.Null(newData.Data2);
        }
Exemple #15
0
            public void Should_Work_For_Some()
            {
                // Arrange
                var maybe    = Maybe.Some <object>(new object());
                var testData = new TestDataClass()
                {
                    Maybe = maybe
                };

                // Act & Assert
                using (var stream = TestUtils.SerializeToStream(testData))
                {
                    var testDataDeserialized = (TestDataClass)TestUtils.DeserializeFromStream(stream);

                    testDataDeserialized.Maybe.ShouldBeOfType <Maybe <object> >();
                    testDataDeserialized.Maybe.HasValue.ShouldBeTrue();
                }
            }
        public void RoundTrip3DArrayClass()
        {
            var expected = new TestDataClass[3, 4, 2];

            for (int z = 0; z < expected.GetLength(2); z++)
            {
                for (int y = 0; y < expected.GetLength(1); y++)
                {
                    for (int x = 0; x < expected.GetLength(0); x++)
                    {
                        expected[x, y, z] = new TestDataClass {
                            A = x + y * 10 + z * 100, B = string.Format("X: {0} Y: {1} Z: {2}", x, y, z)
                        }
                    }
                }
            }
            ;

            CompileAndLoadAssets((TestDataClass[, , ])expected.Clone(), result =>
            {
                Assert.IsNotNull(result);
                Assert.IsInstanceOf <TestDataClass[, , ]>(result);
                Assert.AreEqual(result.Rank, 3);

                for (int i = 0; i < result.Rank; i++)
                {
                    Assert.AreEqual(expected.GetLength(i), result.GetLength(i));
                }

                for (int z = 0; z < expected.GetLength(2); z++)
                {
                    for (int y = 0; y < expected.GetLength(1); y++)
                    {
                        for (int x = 0; x < expected.GetLength(0); x++)
                        {
                            Assert.AreEqual(expected[x, y, z], result[x, y, z]);
                        }
                    }
                }
            });
        }
        public void ParseString_WithThatHasThreeFieldsTakeFirstAndThird_ReturnsParsedObject()
        {
            string           parseSource     = "One  Three2";
            List <DataField> twoColumnFields = new List <DataField>
            {
                new DataField {
                    PropertyName = "StringColumn", DataType = typeof(string), StartIndex = 0, Length = 5
                },
                new DataField {
                    PropertyName = "Spacer", DataFieldName = string.Empty, DataType = typeof(string), StartIndex = 5, Length = 5
                },
                new DataField {
                    PropertyName = "IntColumn", DataType = typeof(int), StartIndex = 10, Length = 5
                },
            };
            FieldParser testParser = new FieldParser(twoColumnFields);

            TestDataClass testData = testParser.ParseString <TestDataClass>(parseSource);

            testData.StringColumn.ShouldBe("One");
            testData.IntColumn.ShouldBe(2);
            testData.DecimalColumn.ShouldBe <decimal>(0m);
        }
 public void DieMatrixReloadedTheory(TestDataClass testData)
 {
     var someVar = testData;
     //Assert something here...
 }
    // Start is called before the first frame update
    void Start()
    {
        OctTree <string, TestDataClass> .OctTreeNode root = new OctTree <string, TestDataClass> .OctTreeNode(Vector3.zero, new Vector3(50.0f, 50.0f, 50.0f));

        m_octTree = new OctTree <string, TestDataClass>(root);

        Profiler.BeginSample("generate octtree");
        m_octTree.GenerateTree(4);
        Profiler.EndSample();

        List <TestDataClass> dataList = new List <TestDataClass>(100);

        for (int i = 0; i < dataList.Capacity; ++i)
        {
            TestDataClass testData = new TestDataClass();
            testData.Key      = "testString" + i.ToString();
            testData.Position = new Vector3(Random.Range(-25.0f, 25.0f), Random.Range(-25.0f, 25.0f), Random.Range(-25.0f, 25.0f));

            dataList.Add(testData);
        }

        m_pointCloud = new PointCloud <TestDataClass>(dataList);
        m_octTree.AddPointCloudData(m_pointCloud);
        //m_ray = new Ray(Vector3.zero, Vector3.up);
        //m_cachedResults = m_octTree.QueryAgainstNodesRay(m_ray, 3);

        m_trajectory = new Trajectory();

        Vector3 origin = Vector3.zero;
        Vector3 dir    = Vector3.up;
        float   time   = 0.0f;

        for (int i = 0; i < 50; ++i)
        {
            Ray ray = new Ray(origin, dir);
            m_trajectory.AddSegment(time, ray);

            time   += 0.5f;
            origin += dir;
            dir     = new Vector3(Random.Range(-5.0f, 5.0f), Random.Range(-10.0f, 10.0f), Random.Range(5.0f, 5.0f)).normalized;
        }

        Profiler.BeginSample("Query result");
        m_cachedResults = new List <CachedResult>();
        foreach (var segment in m_trajectory.TrajectorySegments.Values)
        {
            var result = m_octTree.QueryAgainstNodesRay(segment.Ray, 4);

            if (result.Count > 0)
            {
                m_cachedResults.Add(new CachedResult
                {
                    Time   = segment.Time,
                    Result = result
                });
            }
        }
        Profiler.EndSample();

        m_testPlayer = FindObjectOfType <TestPlayer>();
    }
 protected void AssertTestDataClass(TestDataClass toAssert, string expectedFieldA, string expectedFieldB)
 {
     Assert.That(toAssert.FieldA, Is.EqualTo(expectedFieldA));
     Assert.That(toAssert.FieldB, Is.EqualTo(expectedFieldB));
 }