示例#1
0
        public void IEnumerable_GetValueEnueramble_Passes()
        {
            var node = new TreeNodeHelper <int>();

            node.Children.Add(
                node.CreateNode(10
                                , node.CreateNode(100)
                                , node.CreateNode(200)
                                )
                , node.CreateNode(20)
                , node.CreateNode(30
                                  , node.CreateNode(100)
                                  )
                );

            AssertionUtils.AssertEnumerable(
                new TreeNodeHelper <int>[] {
                node,
                node.Children[0], node.Children[0][0], node.Children[0][1],
                node.Children[1],
                node.Children[2], node.Children[2][0]
            }.Select(_n => _n.Value)
                , node.GetValueEnumerable()
                , ""
                );
        }
示例#2
0
        public void Children_Property_Passes()
        {
            var node = new TreeNodeHelper <int>();
            {
                node.Children.Add(
                    TreeNodeHelper <int> .Create(100)
                    , TreeNodeHelper <int> .Create(200)
                    , TreeNodeHelper <int> .Create(300));

                AssertionUtils.AssertEnumerable(
                    new int[] {
                    100, 200, 300
                }
                    , node.Children.Select(_c => _c.Value)
                    , ""
                    );
                Assert.IsTrue(node.Children.All(_c => _c.Parent == node));
            }

            {
                node.Children.RemoveAt(1);
                AssertionUtils.AssertEnumerable(
                    new int[] {
                    100, 300
                }
                    , node.Children.Select(_c => _c.Value)
                    , ""
                    );
                Assert.IsTrue(node.Children.All(_c => _c.Parent == node));
            }
        }
示例#3
0
        public void TakeSnapshotPasses()
        {
            var data = new SnapshotData
            {
                value1 = 100,
                value2 = "Test",
            };
            var stackFrame = new StackFrame();

            System.Func <SnapshotData, SnapshotData, bool> validateSnapshot = (correct, got) => correct.AreSame(got);

            //Snapshotの作成のテスト
            DoTakeSnapshot = true;
            var snapshot = TakeOrValid(data, stackFrame, 0, validateSnapshot,
                                       "Failed to Take snapshot...");

            Assert.AreSame(snapshot, LastSnapshot);

            var snapshotFilepath = CreateSnapshotFilepath(stackFrame);

            Assert.AreEqual(snapshot.GetAssetPath(), snapshotFilepath);

            Assert.IsTrue(Hinode.Editors.EditorFileUtils.IsExistAsset(snapshotFilepath), $"don't exist snapshot file... filepath='{snapshotFilepath}'");
            var savedSnapshot = AssetDatabase.LoadAssetAtPath <Snapshot>(snapshotFilepath);

            AssertionUtils.AssertEnumerable(new[] { "snapshot" }, AssetDatabase.GetLabels(savedSnapshot), "想定したラベルが付けられていません。");

            //Snapshotによる検証のテスト
            DoTakeSnapshot = false;
            Assert.DoesNotThrow(() => {
                var snap = TakeOrValid(data, stackFrame, 0, validateSnapshot, "Failed to Take snapshot...");
                Assert.AreSame(snap, LastSnapshot);
            });
            ReserveDeleteAssets(snapshotFilepath);
        }
        public void BasicUsagePasses()
        {
            var query           = ".style1";
            var layoutValueDict = new ViewLayoutValueDictionary()
                                  .AddValue("key", 100)
                                  .AddValue("key2", 200);
            var layoutValueDict2 = new ViewLayoutValueDictionary()
                                   .AddValue("apple", -100)
                                   .AddValue("orange", -200);

            var layoutOverwriter = new ViewLayoutOverwriter();

            layoutOverwriter
            .Add(new ViewLayoutSelector(query, ""), layoutValueDict)
            .Add(new ViewLayoutSelector($"Model {query}", ""), layoutValueDict2);

            var model = new Model()
            {
                Name = "Model"
            }
            .AddStylingID(query);

            AssertionUtils.AssertEnumerable(
                new ViewLayoutValueDictionary[] {
                layoutValueDict2,
                layoutValueDict,
            }
                , layoutOverwriter.MatchLayoutValueDicts(model, null)
                , "");
        }
示例#5
0
        public void TryBuildTest(string testFolder)
        {
            var packages = ReadPackages(testFolder);

            CollectionAssert.IsNotEmpty(packages, $"Packages collection must be not empty for {testFolder}");

            var handBuilder = new PokerBaaziHandBuilder();

            HandHistory actual = null;

            foreach (var package in packages.Where(x => x.PackageType != PokerBaaziPackageType.Unknown))
            {
                if (handBuilder.TryBuild(package, out actual, out PokerBaaziHandBuilderError error))
                {
                    break;
                }
            }

            Assert.IsNotNull(actual, $"Actual HandHistory must be not null for {testFolder}");

            var expected = ReadExpectedHandHistory(testFolder);

            Assert.IsNotNull(expected, $"Expected HandHistory must be not null for {testFolder}");

            AssertionUtils.AssertHandHistory(actual, expected);
        }
示例#6
0
        public void TryBuildTest(string testFolder, uint heroId)
        {
            var packages = ReadPackages(testFolder);

            CollectionAssert.IsNotEmpty(packages, $"Packages collection must be not empty for {testFolder}");

            var handBuilder = new PKHandBuilder();

            HandHistory actual = null;

            foreach (var package in packages)
            {
                package.UserId = heroId;

                if (handBuilder.TryBuild(package, identifier, out actual))
                {
                    break;
                }
            }

            Assert.IsNotNull(actual, $"Actual HandHistory must be not null for {testFolder}");

            var expected = ReadExpectedHandHistory(testFolder);

            Assert.IsNotNull(expected, $"Expected HandHistory must be not null for {testFolder}");

            AssertionUtils.AssertHandHistory(actual, expected);
        }
示例#7
0
        public void MinSizePropertyPasses()
        {
            {
                var info = new LayoutInfo();
                AssertionUtils.AreNearlyEqual(LayoutInfo.UNFIXED_VECTOR3, info.MinSize, LayoutDefines.NUMBER_PRECISION, $"Default値が異なります。設定されていないことを表す値にしてください。");
            }
            Debug.Log($"Success to Default MinSize Property!");

            {
                var info = new LayoutInfo();
                var size = Vector3.one * 100f;
                info.MinSize = size;

                AssertionUtils.AreNearlyEqual(size, info.MinSize);
            }
            Debug.Log($"Success to Set MinSize Property!");

            {
                var info = new LayoutInfo();
                info.MaxSize = Vector3.one * 50f;
                info.MinSize = Vector3.one * 100f;
                AssertionUtils.AreNearlyEqual(info.MaxSize, info.MinSize);
            }
            Debug.Log($"Success to MinSize Property When greater MaxSize!");

            {
                var info = new LayoutInfo();
                info.MaxSize = Vector3.one * 50f;
                info.MinSize = LayoutInfo.UNFIXED_VECTOR3;
                AssertionUtils.AreNearlyEqual(LayoutInfo.UNFIXED_VECTOR3, info.MinSize);
            }
            Debug.Log($"Success to MinSize Property When INVALID_VECTOR3!");
        }
示例#8
0
        public void RemovePasses()
        {
            var helper = new HashSetHelper <int>();

            var testData = new int[] {
                100, 200
            };

            foreach (var d in testData)
            {
                helper.Add(d);
            }

            helper.Remove(testData[0]);
            AssertionUtils.AssertEnumerableByUnordered(
                new int[] { testData[1] }
                , helper.Items
                , ""
                );

            helper.Remove(testData[1]);
            AssertionUtils.AssertEnumerableByUnordered(
                new int[] { }
                , helper.Items
                , ""
                );
        }
示例#9
0
            protected override void Validate()
            {
                var target     = AspectLayout.Target;
                var layoutSize = Parent.LayoutInfo.GetLayoutSize(Parent)
                                 .Mul(target.AnchorMax - target.AnchorMin);

                var(baseSize, offset) = CalSizeAndOffset(layoutSize, AspectLayout.Padding);
                var size = AdjustSize(baseSize, AspectLayout.AspectRatio);

                var fixedSize = Vector3.one * AspectLayout.FixedLength;

                fixedSize.z  = 0;
                fixedSize.x *= AspectLayout.AspectRatio;

                if (fixedSize.x <= size.x && fixedSize.y <= size.y)
                {
                    size.x = fixedSize.x;
                    size.y = fixedSize.y;
                }

                AssertionUtils.AreNearlyEqual(size, target.LocalSize, LayoutDefines.NUMBER_PRECISION, $"Fail Test... LocalSize");
                AssertionUtils.AreNearlyEqual(offset, target.Offset, LayoutDefines.NUMBER_PRECISION, $"Fail Test... Offset");
                Assert.IsTrue(baseSize.x >= target.LocalSize.x &&
                              baseSize.y >= target.LocalSize.y,
                              $"Test Fail... baseSize={baseSize:F4}, localSize={target.LocalSize:F4}"
                              );
            }
示例#10
0
        public void SetMinMaxSizePasses()
        {
            {
                var info = new LayoutInfo();
                var min  = Vector3.one * 10f;
                var max  = Vector3.one * 100f;
                info.SetMinMaxSize(min, max);

                AssertionUtils.AreNearlyEqual(min, info.MinSize);
                AssertionUtils.AreNearlyEqual(max, info.MaxSize);
            }
            Debug.Log($"Success to SetMinMaxSize()!");

            {
                var info = new LayoutInfo();
                var min  = new Vector3(20, 40, 60);
                var max  = new Vector3(30, 10, 70);
                info.SetMinMaxSize(min, max);

                AssertionUtils.AreNearlyEqual(Vector3.Min(min, max), info.MinSize);
                AssertionUtils.AreNearlyEqual(Vector3.Max(min, max), info.MaxSize);
            }
            Debug.Log($"Success to MaxSize Property When greater MaxSize!");

            {
                var info = new LayoutInfo();
                var min  = new Vector3(-1, 40, -1);
                var max  = new Vector3(30, -1, 70);
                info.SetMinMaxSize(min, max);

                AssertionUtils.AreNearlyEqual(new Vector3(-1, 40, -1), info.MinSize);
                AssertionUtils.AreNearlyEqual(new Vector3(30, -1, 70), info.MaxSize);
            }
            Debug.Log($"Success to MaxSize Property When INVALID_VECTOR3!");
        }
示例#11
0
 public void AlphabetKeyCodesPasses()
 {
     AssertionUtils.AssertEnumerableByUnordered(
         new KeyCode[] {
         KeyCode.A,
         KeyCode.B,
         KeyCode.C,
         KeyCode.D,
         KeyCode.E,
         KeyCode.F,
         KeyCode.G,
         KeyCode.H,
         KeyCode.I,
         KeyCode.J,
         KeyCode.K,
         KeyCode.L,
         KeyCode.M,
         KeyCode.N,
         KeyCode.O,
         KeyCode.P,
         KeyCode.Q,
         KeyCode.R,
         KeyCode.S,
         KeyCode.T,
         KeyCode.U,
         KeyCode.V,
         KeyCode.W,
         KeyCode.X,
         KeyCode.Y,
         KeyCode.Z
     }
         , KeyCodeDefines.AlphabetKeyCodes
         , ""
         );
 }
示例#12
0
 public void KeypadKeyCodesPasses()
 {
     AssertionUtils.AssertEnumerableByUnordered(
         new KeyCode[] {
         KeyCode.Keypad0,
         KeyCode.Keypad1,
         KeyCode.Keypad2,
         KeyCode.Keypad3,
         KeyCode.Keypad4,
         KeyCode.Keypad5,
         KeyCode.Keypad6,
         KeyCode.Keypad7,
         KeyCode.Keypad8,
         KeyCode.Keypad9,
         KeyCode.KeypadPeriod,
         KeyCode.KeypadDivide,
         KeyCode.KeypadMultiply,
         KeyCode.KeypadMinus,
         KeyCode.KeypadPlus,
         KeyCode.KeypadEnter,
         KeyCode.KeypadEquals
     }
         , KeyCodeDefines.KeypadKeyCodes
         , ""
         );
 }
示例#13
0
        public void AllSupportedKeyCodesPasses()
        {
            var ignoreKeyCodes = new HashSet <KeyCode>()
            {
                KeyCode.RightApple,
                KeyCode.LeftApple,
            };

            // 同値のEnumに対応するために使用している
            var ignoreCounter = new Dictionary <KeyCode, int>();

            AssertionUtils.AssertEnumerableByUnordered(
                System.Enum.GetValues(typeof(KeyCode))
                .GetEnumerable <KeyCode>()
                .Where(_k => {
                if (!ignoreKeyCodes.Contains(_k))
                {
                    return(true);
                }
                if (ignoreCounter.ContainsKey(_k))
                {
                    return(false);
                }
                ignoreCounter.Add(_k, 1);
                return(true);
            }).ToArray(),
                KeyCodeDefines.AllSupportedKeyCodes,
                ""
                );
        }
示例#14
0
        public void GetFlagEnumCombinationPasses()
        {
            var flagsEnumerable = IndexCombinationEnumerable.GetFlagEnumCombination(
                TestFlags.A,
                TestFlags.D,
                TestFlags.E
                );

            //foreach(var f in flagsEnumerable)
            //{
            //    Debug.Log($"flags => {f}");
            //}
            AssertionUtils.AssertEnumerable(
                new TestFlags[] {
                TestFlags.A,
                TestFlags.A | TestFlags.D,
                TestFlags.A | TestFlags.D | TestFlags.E,
                TestFlags.A | TestFlags.E,
                TestFlags.D,
                TestFlags.D | TestFlags.E,
                TestFlags.E,
            },
                flagsEnumerable,
                ""
                );
        }
示例#15
0
        public void UpdateLayout_Passes()
        {
            var parent  = new LayoutTargetObject();
            var target  = new LayoutTargetObject();
            var correct = new LayoutTargetObject();

            parent.UpdateLocalSize(Vector3.one * 100f, Vector3.zero);

            correct.UpdateAnchorParam(Vector3.zero, Vector3.one, Vector3.zero, Vector3.zero);
            correct.IsAutoUpdate = false;
            correct.SetParent(parent);
            correct.FollowParent();

            var(offsetMin, offsetMax) = correct.AnchorOffsetMinMax();
            target.IsAutoUpdate       = false;
            target.UpdateAnchorParam(correct.AnchorMin, correct.AnchorMax, offsetMin, offsetMax);
            target.SetParent(parent);

            //test point
            var layout = new ParentFollowLayout();

            layout.Target = target;
            layout.UpdateLayout();

            AssertionUtils.AreNearlyEqual(correct.LocalSize, target.LocalSize, LayoutDefines.POS_NUMBER_PRECISION);
            AssertionUtils.AreNearlyEqual(correct.Offset, target.Offset, LayoutDefines.POS_NUMBER_PRECISION);
        }
示例#16
0
        public void OnRemovedInRemoveItemsPasses()
        {
            var helper       = new HashSetHelper <int>();
            var recievedList = new List <int>();
            var counter      = 0;

            helper.OnRemoved.Add((v) => { recievedList.Add(v); counter++; });


            var testData = Enumerable.Range(0, 10);

            helper.Add(testData);

            helper.Remove(testData.Where(_v => _v % 2 == 0));

            Assert.AreEqual(testData.Count() / 2, counter);
            AssertionUtils.AssertEnumerableByUnordered(
                testData.Where(_v => _v % 2 == 0),
                recievedList,
                ""
                );
            AssertionUtils.AssertEnumerableByUnordered(
                testData.Where(_v => _v % 2 != 0),
                helper.Items,
                ""
                );
        }
示例#17
0
        public void OverwriteMergePasses()
        {
            var dict = new Dictionary <string, int>()
            {
                { "Apple", 1 },
                { "Orange", 2 },
            };

            var src = new Dictionary <string, int>()
            {
                { "Grape", 3 },
                { "Apple", 111 }
            };
            var src2 = new Dictionary <string, int>()
            {
                { "Banana", 4 },
                { "Grape", 333 },
                { "Orange", 222 }
            };

            dict.Merge(true, src, src2);
            AssertionUtils.AreEqual(new Dictionary <string, int>()
            {
                { "Apple", 111 },
                { "Orange", 222 },
                { "Grape", 333 },
                { "Banana", 4 },
            }
                                    , dict, "Failed Merge by Overwrite mode...");
        }
示例#18
0
        public void AddItemsWhenOccurExceptionPasses()
        {
            var helper       = new HashSetHelper <int>();
            var recievedList = new List <int>();
            var counter      = 0;

            helper.OnAdded.Add((v) => {
                if (v % 2 == 0)
                {
                    throw new System.Exception();
                }
                recievedList.Add(v); counter++;
            });


            var testData = Enumerable.Range(0, 10);

            Assert.DoesNotThrow(() => {
                helper.Add(testData);
            });

            Assert.AreEqual(testData.Count() / 2, counter);
            AssertionUtils.AssertEnumerableByUnordered(
                testData.Where(_v => _v % 2 != 0),
                recievedList,
                ""
                );
            AssertionUtils.AssertEnumerableByUnordered(
                testData,
                helper.Items,
                ""
                );
        }
示例#19
0
        public IEnumerator AttachPasses()
        {
            var recorder = new GameObject().AddComponent <InputRecorderMonoBehaviour>();
            var inputObj = recorder.gameObject.AddComponent <AppendAxisButtonInputData>();

            yield return(null);

            var names = new string[] { "Horizontal", "Vertical" };

            inputObj.AddEnabledAxisButtons(names);

            inputObj.Attach();
            var frameInputData = recorder.UseRecorder.FrameDataRecorder as FrameInputData;

            Assert.IsTrue(frameInputData.ContainsChildRecorder <AxisButtonFrameInputData>());

            var axisButtonData = frameInputData.GetChildRecorderEnumerable()
                                 .Select(_t => _t.child)
                                 .OfType <AxisButtonFrameInputData>()
                                 .FirstOrDefault();

            AssertionUtils.AssertEnumerableByUnordered(
                names
                , axisButtonData.ObservedButtonNames
                , ""
                );
        }
示例#20
0
        public WritesAttribute(params Type[] types)
        {
            AssertionUtils.ValuesNotNull(types, nameof(types));
            AssertionUtils.TypesAreStruct(types);

            Types = types;
        }
        protected virtual void AssertThatIndicatorIsCalculated(Expression <Func <HudLightIndicators, StatDto> > expression, string fileName, EnumPokerSites pokerSite, string playerName, decimal expected, int occurredExpected, int couldOccurredExpected, [CallerMemberName] string method = "UnknownMethod")
        {
            using (var perfScope = new PerformanceMonitor(method))
            {
                var indicator = new HudLightIndicators();

                Playerstatistic playerstatistic = null;

                var playerStatisticRepository = ServiceLocator.Current.GetInstance <IPlayerStatisticRepository>();
                playerStatisticRepository.Store(Arg.Is <Playerstatistic>(x => GetSinglePlayerstatisticFromStoreCall(ref playerstatistic, x, playerName)));

                FillDatabaseFromSingleFile(fileName, pokerSite);

                Assert.IsNotNull(playerstatistic, $"Player '{playerName}' has not been found");

                indicator.AddStatistic(playerstatistic);

                var getStat = expression.Compile();

                var actualStatDto   = getStat(indicator);
                var expectedStatDto = new StatDto
                {
                    Value         = expected,
                    Occurred      = occurredExpected,
                    CouldOccurred = couldOccurredExpected
                };

                AssertionUtils.AssertStatDto(actualStatDto, expectedStatDto);
            }
        }
        public IEnumerator AttachPasses()
        {
            var recorder = new GameObject().AddComponent <InputRecorderMonoBehaviour>();
            var inputObj = recorder.gameObject.AddComponent <AppendKeyboardInputData>();

            yield return(null);

            var keycodes = new KeyCode[] { KeyCode.A, KeyCode.F1 };

            inputObj.AddEnabledKeyCodes(keycodes);

            inputObj.Attach();
            var frameInputData = recorder.UseRecorder.FrameDataRecorder as FrameInputData;

            Assert.IsTrue(frameInputData.ContainsChildRecorder <KeyboardFrameInputData>());

            var inputData = frameInputData.GetChildRecorderEnumerable()
                            .Select(_t => _t.child)
                            .OfType <KeyboardFrameInputData>()
                            .FirstOrDefault();

            AssertionUtils.AssertEnumerableByUnordered(
                keycodes
                , inputData.ObservedKeyCodes
                , ""
                );
        }
示例#23
0
        public void IEnumerable_Passes()
        {
            var node = new TreeNodeHelper <int>();

            node.Children.Add(
                node.CreateNode(10)
                , node.CreateNode(20)
                , node.CreateNode(30));

            node[0].Children.Add(
                node.CreateNode(100)
                , node.CreateNode(200));

            node[2].Children.Add(
                node.CreateNode(100));

            AssertionUtils.AssertEnumerable(
                new TreeNodeHelper <int>[] {
                node,
                node.Children[0], node.Children[0][0], node.Children[0][1],
                node.Children[1],
                node.Children[2], node.Children[2][0]
            }
                , node
                , ""
                );
        }
        public void TryBuildTest(string testFolder)
        {
            HandHistory actual = null;

            using (ShimsContext.Create())
            {
                ShimDateTime.UtcNowGet = () => handDate;

                var packages = ReadPackages(testFolder);

                CollectionAssert.IsNotEmpty(packages, $"Packages collection must be not empty for {testFolder}");

                var handBuilder = new Adda52HandBuilder();

                foreach (var package in packages)
                {
                    if (handBuilder.TryBuild(package, out actual))
                    {
                        break;
                    }
                }
            }

            Assert.IsNotNull(actual, $"Actual HandHistory must be not null for {testFolder}");

            var expected = ReadExpectedHandHistory(testFolder);

            Assert.IsNotNull(expected, $"Expected HandHistory must be not null for {testFolder}");

            AssertionUtils.AssertHandHistory(actual, expected);
        }
        public void TryBuildTest(string testFolder)
        {
            var packages = ReadPackages(testFolder);

            CollectionAssert.IsNotEmpty(packages, $"Packages collection must be not empty for {testFolder}");

            var handBuilder = new PPPHandBuilder();

            HandHistory actual = null;

            if (testFolder == NlheSngTest)
            {
                using (ShimsContext.Create())
                {
                    ShimDateTime.UtcNowGet = () => new DateTime(2018, 10, 11, 17, 07, 14);

                    Build(handBuilder, packages, out actual);
                }
            }
            else
            {
                Build(handBuilder, packages, out actual);
            }


            Assert.IsNotNull(actual, $"Actual HandHistory must be not null for {testFolder}");

            var expected = ReadExpectedHandHistory(testFolder);

            Assert.IsNotNull(expected, $"Expected HandHistory must be not null for {testFolder}");

            AssertionUtils.AssertHandHistory(actual, expected);
        }
示例#26
0
        public void SetParamByIndexPasses()
        {
            var data = new HavingTextResourceData();

            data.ResizeParams(3);
            data.SetParam(0, 100);
            data.SetParam(1, "Apple");
            data.SetParam(2, 1.23f);

            Assert.AreEqual(3, data.ParamCount);
            AssertionUtils.AssertEnumerable(
                new object[]
            {
                100,
                "Apple",
                1.23f,
            },
                data.GetTextResourceParams(),
                "");

            Debug.Log($"Success to Basic SetParam");

            Assert.Throws <UnityEngine.Assertions.AssertionException>(() => {
                data.SetParam(10, 654);
            });
            Debug.Log($"Success to Out of Range Index(over paramCount)");
            Assert.Throws <UnityEngine.Assertions.AssertionException>(() => {
                data.SetParam(-1, 654);
            });
            Debug.Log($"Success to Out of Range Index(minus index)");
        }
        public IEnumerator Entry_Passes()
        {
            var manager = LayoutManagerComponent.Instance;

            var layoutTarget = CreateLayoutTargetComponent("__test");

            manager.Entry(layoutTarget);

            TestLayoutManager.AssertRootsInLayoutManagerGroup(manager.Manager
                                                              , new ILayoutTarget[] {
                layoutTarget.LayoutTarget
            }
                                                              );
            var group = manager.Manager.Groups.First(_g => _g.Root == layoutTarget.LayoutTarget);

            TestLayoutManager.AssertLayoutManagerGroup(group, layoutTarget.LayoutTarget, group.Priority, null, null,
                                                       new ILayoutTarget[] {
                layoutTarget.LayoutTarget
            }
                                                       );


            AssertionUtils.AssertEnumerableByUnordered(
                new LayoutTargetComponent[] {
                layoutTarget
            }
                , manager.Targets
                , ""
                );
            yield return(null);
        }
示例#28
0
        public void ResizeParamsPasses()
        {
            var data = new HavingTextResourceData()
            {
                HavingTextResourceKey = "key1",
            };
            var paramList = new object[]
            {
                100,
                "Apple",
                1.23f,
            };

            data.SetParams(paramList);

            {
                data.ResizeParams(1);
                Assert.AreEqual(1, data.ParamCount);
                AssertionUtils.AssertEnumerable(
                    new object[] { paramList[0] },
                    data.GetTextResourceParams(),
                    "");
            }
            Debug.Log($"Success to Resize paramList(Reduce ParamCount)");

            {
                data.ResizeParams(3);
                Assert.AreEqual(3, data.ParamCount);
                AssertionUtils.AssertEnumerable(
                    new object[] { paramList[0], null, null },
                    data.GetTextResourceParams(),
                    "");
            }
            Debug.Log($"Success to Resize paramList(Increase ParamCount)");
        }
示例#29
0
        public void BasicUsagePasses()
        {
            //foreach(var pair in new IndexCombinationEnumerable(4))
            //{
            //    var log = pair.Select(_i => _i.ToString()).Aggregate((_s, _c) => _s + "," + _c);
            //    Debug.Log(log);
            //}

            AssertionUtils.AssertEnumerable(
                new List <int[]>()
            {
                new int[] { 0 },
                new int[] { 0, 1 },
                new int[] { 0, 1, 2 },
                new int[] { 0, 1, 2, 3 },
                new int[] { 0, 1, 3 },
                new int[] { 0, 2 },
                new int[] { 0, 2, 3 },
                new int[] { 0, 3 },
                new int[] { 1 },
                new int[] { 1, 2 },
                new int[] { 1, 2, 3 },
                new int[] { 1, 3 },
                new int[] { 2 },
                new int[] { 2, 3 },
                new int[] { 3 },
            },
                new IndexCombinationEnumerable(4),
                "",
                (_correct, _got) => {
                var correct = _correct.ToArray();
                var got     = _got.ToArray();
                if (correct.Length != got.Length)
                {
                    Debug.LogWarning($"Not Equal Length... corrent={correct.Length}, got={got.Length}");
                    Logger.LogWarning(Logger.Priority.High, () => {
                        var correctList = correct.Select(_e => _e.ToString()).Aggregate((_s, _c) => _s + "," + _c);
                        var gotList     = got.Select(_e => _e.ToString()).Aggregate((_s, _c) => _s + "," + _c);
                        return($"correct list=> {correctList};{System.Environment.NewLine}got list=>{gotList}");
                    });
                    return(false);
                }
                for (var i = 0; i < correct.Length; ++i)
                {
                    if (correct[i] != got[i])
                    {
                        Debug.LogWarning($"Not Equal element[{i}]... corrent={correct[i]}, got={got[i]}");
                        Logger.LogWarning(Logger.Priority.High, () => {
                            var correctList = correct.Select(_e => _e.ToString()).Aggregate((_s, _c) => _s + "," + _c);
                            var gotList     = got.Select(_e => _e.ToString()).Aggregate((_s, _c) => _s + "," + _c);
                            return($"correct list=> {correctList};{System.Environment.NewLine}got list=>{gotList}");
                        });
                        return(false);
                    }
                }
                return(true);
            }
                );
        }
示例#30
0
 // Custom RequestMatcher for test
 protected static RequestMatcher MatchHeaderStartsWith(string header, string value)
 {
     return(request =>
     {
         string headerValue = request.Headers[header];
         AssertionUtils.IsTrue(headerValue.StartsWith(value), "Expected header value to start with: " + value);
     });
 }