コード例 #1
0
        private static IEnumerable <TestCaseData> GetCases()
        {
            var providerNames =
                (
                    from t in new DatabaseTestCase[]
            {
                new T1(), new T2(), new T3(), new T4(), new T5(), new T6(), new T7(), new T8(), new T9(), new T10(),
                new T11(), new T12(), new T13(), new T14(), new T15(), new T16()
            }
                    where t.ProviderName != null
                    select t.ProviderName
                ).ToArray();

            var cases = providerNames.Select(name => new { name, isLinqService = false }).ToArray();

            if (typeof(T1) == typeof(DatabaseTestCase.LinqService))
            {
                cases = cases.Concat(providerNames.Select(name => new { name, isLinqService = true })).ToArray();
            }

            foreach (var c in cases)
            {
                var data = new TestCaseData(c.isLinqService ? c.name + ".LinqService" : c.name).SetCategory(c.name);

                if (c.isLinqService)
                {
                    data = data
                           .SetName(c.name + " Linq Service")
                           .SetCategory("Linq Service");
                }
                else
                {
                    data = data.SetName(c.name);
                }

                yield return(data);
            }
        }
        public static IEnumerable <TestCaseData> ForCollision_GetDimensionFromIntersection()
        {
            string       name;
            TestCaseData t;

            name = "左方向からの接触";
            t    = new TestCaseData(
                new Bounds(
                    new Vector3(0, 0, 0),
                    new Vector3(50, 100, 20)
                    ),
                new Bounds(
                    new Vector3(0, 0, 0),
                    new Vector3(5, 100, 20)
                    ),
                ActionSample.Domain.Collision.DIMENSION.LEFT

                );
            t.SetName(name);
            yield return(t);

            name = "右方向からの接触";
            t    = new TestCaseData(
                new Bounds(
                    new Vector3(0, 0, 0),
                    new Vector3(50, 100, 20)
                    ),
                new Bounds(
                    new Vector3(45, 0, 0),
                    new Vector3(5, 100, 20)
                    ),
                ActionSample.Domain.Collision.DIMENSION.RIGHT

                );
            t.SetName(name);
            yield return(t);

            name = "上方向からの接触";
            t    = new TestCaseData(
                new Bounds(
                    new Vector3(0, 0, 0),
                    new Vector3(50, 100, 20)
                    ),
                new Bounds(
                    new Vector3(0, 95, 0),
                    new Vector3(50, 5, 20)
                    ),
                ActionSample.Domain.Collision.DIMENSION.TOP

                );
            t.SetName(name);
            yield return(t);

            name = "下方向からの接触";
            t    = new TestCaseData(
                new Bounds(
                    new Vector3(0, 0, 0),
                    new Vector3(50, 100, 20)
                    ),
                new Bounds(
                    new Vector3(0, 5, 0),
                    new Vector3(50, 5, 20)
                    ),
                ActionSample.Domain.Collision.DIMENSION.BOTTOM

                );
            t.SetName(name);
            yield return(t);

            name = "手前方向からの接触";
            t    = new TestCaseData(
                new Bounds(
                    new Vector3(0, 0, 0),
                    new Vector3(50, 100, 20)
                    ),
                new Bounds(
                    new Vector3(0, 0, 0),
                    new Vector3(50, 100, 5)
                    ),
                ActionSample.Domain.Collision.DIMENSION.FRONT

                );
            t.SetName(name);
            yield return(t);

            name = "奥方向からの接触";
            t    = new TestCaseData(
                new Bounds(
                    new Vector3(0, 0, 0),
                    new Vector3(50, 100, 20)
                    ),
                new Bounds(
                    new Vector3(0, 0, 15),
                    new Vector3(50, 100, 5)
                    ),
                ActionSample.Domain.Collision.DIMENSION.REAR

                );
            t.SetName(name);
            yield return(t);

            name = "接触していない場合";
            t    = new TestCaseData(
                new Bounds(
                    new Vector3(0, 0, 0),
                    new Vector3(50, 100, 20)
                    ),
                new Bounds(
                    new Vector3(0, 0, 0),
                    new Vector3(0, 0, 0)
                    ),
                null

                );
            t.SetName(name);
            yield return(t);

            name = "わずかな差で左方向と検出される場合";
            t    = new TestCaseData(
                new Bounds(
                    new Vector3(0, 0, 0),
                    new Vector3(50, 50, 20)
                    ),
                new Bounds(
                    new Vector3(14, 15, 0),
                    new Vector3(14, 15, 20)
                    ),
                ActionSample.Domain.Collision.DIMENSION.LEFT
                );
            t.SetName(name);
            yield return(t);
        }
コード例 #3
0
        public static IEnumerable <TestCaseData> ForGetIntersection()
        {
            TestCaseData t;
            string       name;

            name = "接触なし__X軸";
            t    = new TestCaseData(
                createBoundsFromLTWH(
                    new Vector3(0, 0, 0),
                    new Vector3(50, 100, 20)
                    ),
                createBoundsFromLTWH(
                    new Vector3(51, 0, 0),
                    new Vector3(50, 100, 20)
                    ),
                null
                );
            t.SetName(name);
            yield return(t);

            name = "接触なし__Y軸";
            t    = new TestCaseData(
                createBoundsFromLTWH(
                    new Vector3(0, 0, 0),
                    new Vector3(50, 100, 20)
                    ),
                createBoundsFromLTWH(
                    new Vector3(0, 101, 0),
                    new Vector3(50, 100, 20)
                    ),
                null
                );
            t.SetName(name);
            yield return(t);

            name = "接触なし__Z軸";
            t    = new TestCaseData(
                createBoundsFromLTWH(
                    new Vector3(0, 0, 0),
                    new Vector3(50, 100, 20)
                    ),
                createBoundsFromLTWH(
                    new Vector3(0, 0, 21),
                    new Vector3(50, 100, 20)
                    ),
                null
                );
            t.SetName(name);
            yield return(t);

            name = "接触あり__X軸";
            t    = new TestCaseData(
                createBoundsFromLTWH(
                    new Vector3(0, 0, 0),
                    new Vector3(50, 100, 20)
                    ),
                createBoundsFromLTWH(
                    new Vector3(49, 0, 0),
                    new Vector3(50, 100, 20)
                    ),
                createBoundsFromLTWH(
                    new Vector3(49, 0, 0),
                    new Vector3(1, 100, 20)
                    )
                );
            t.SetName(name);
            yield return(t);

            name = "接触あり__Y軸";
            t    = new TestCaseData(
                createBoundsFromLTWH(
                    new Vector3(0, 0, 0),
                    new Vector3(50, 100, 20)
                    ),
                createBoundsFromLTWH(
                    new Vector3(0, 99, 0),
                    new Vector3(50, 100, 20)
                    ),
                createBoundsFromLTWH(
                    new Vector3(0, 99, 0),
                    new Vector3(50, 1, 20)
                    )
                );
            t.SetName(name);
            yield return(t);

            name = "接触あり__Z軸";
            t    = new TestCaseData(
                createBoundsFromLTWH(
                    new Vector3(0, 0, 0),
                    new Vector3(50, 100, 20)
                    ),
                createBoundsFromLTWH(
                    new Vector3(0, 0, 19),
                    new Vector3(50, 100, 20)
                    ),
                createBoundsFromLTWH(
                    new Vector3(0, 0, 19),
                    new Vector3(50, 100, 1)
                    )
                );
            t.SetName(name);
            yield return(t);
        }