Пример #1
0
        public void GeometricCalculator_When_Calculating_Key_From_Vertices_Then_Results_Match_Expected()
        {
            var expectedResults = CreateTestValues();

            // Given a calculator
            var calc = new GeometricApp.Services.GeometricCalculator(length: 10, numColumns: 12);

            foreach (var kvp in expectedResults)
            {
                // When calling calculate key from vertices
                var list            = CreateVertexList(kvp.Value);
                var keyFromVertices = calc.CalculateKeyFromVertices(list);

                // Then the calculated key matches expected;
                Assert.AreEqual(kvp.Key, keyFromVertices);
            }
        }
Пример #2
0
        public void GeometricCalculator_When_Calculating_Vertices_From_Key_Then_Results_Match_Expected()
        {
            var expectedResults = CreateTestValues();

            // Given a calculator
            var calc = new GeometricApp.Services.GeometricCalculator(length: 10, numColumns: 12);

            foreach (var kvp in expectedResults)
            {
                // When calling calculate vertices from key
                var arr = calc.CalculateVerticesFromKey(kvp.Key).ToArray();

                // Then the results should match expected
                for (int i = 0; i < kvp.Value.Count; i++)
                {
                    var item = kvp.Value[i];

                    Assert.AreEqual(item[0], arr[i].X);
                    Assert.AreEqual(item[1], arr[i].Y);
                }
            }
        }