Esempio n. 1
0
        public void GoalMappingSucceeds()
        {
            var uri = new Uri("https://rprcorporate.blob.core.windows.net/media/sampletrophy.png?sp=rl&st=2021-03-28T19:06:34Z&se=2025-03-29T19:06:00Z&sv=2020-02-10&sr=b&sig=M3oKCysFeKGWw7jDnn1kCFNTFHdqxoOtKVzVFIYXXZs%3D");
            var a   = new Goal().ToMock(uri);
            var ad  = new GoalDisplay().Map(a);

            Assert.IsTrue(a.SimpleName == ad.SimpleName);
            Assert.IsTrue(a.MediaTranslations[0].SelectedMediaUri.Uri.AbsoluteUri == ad.MediaTranslations[0].SelectedMediaUri.Uri.AbsoluteUri);
        }
Esempio n. 2
0
        public void TestGoalMocking()
        {
            var uri = new Uri("https://rprcorporate.blob.core.windows.net/media/sampletrophy.png?sp=rl&st=2021-03-28T19:06:34Z&se=2025-03-29T19:06:00Z&sv=2020-02-10&sr=b&sig=M3oKCysFeKGWw7jDnn1kCFNTFHdqxoOtKVzVFIYXXZs%3D");

            var gd = new GoalDisplay().ToMock(uri);

            Assert.IsTrue(gd.Awards.Count > 0);
            Assert.IsTrue(gd.Awards[0].Value == 400);

            var gd1 = new GoalDisplay().ToMock(uri);

            Assert.IsTrue(!string.IsNullOrEmpty(gd1.SimpleName));
        }
        public static GoalDisplay Map(this GoalDisplay to, Goal from)
        {
            var config = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile <GoalProfile>();
                cfg.AddProfile <AwardRuleProfile>();
            });

            IMapper mapper = new Mapper(config);

            mapper.Map(from, to);

            return(to);
        }
        public static GoalDisplay ToMock(this GoalDisplay cb, Uri uri)
        {
            string          rawText = Lipsums.LoremIpsum;
            LipsumGenerator lipsum  = new LipsumGenerator(rawText, false);

            return(new GoalDisplay()
            {
                Awards = new List <AwardRuleDisplay>()
                {
                    new AwardRuleDisplay()
                    {
                        Value = 400,
                    }
                },

                SimpleName = $"{lipsum.GenerateWords(1)[0]}",
                NameTranslations = new StringTranslationsCore().Map(new StringTranslations().ToMock()),
                MediaTranslations = new MediaTranslationsCore().Map(new MediaTranslations().ToMock(uri))
            });
        }
Esempio n. 5
0
        void CustomInitialize()
        {
            Camera.Main.OrthogonalHeight /= BaseZoomFactor;
            Camera.Main.OrthogonalWidth  /= BaseZoomFactor;
            Camera.Main.AttachTo(PlayerInstance);
            Camera.Main.RelativeZ = 100;

            BallListCollisionCircleVsGoalCollision.CollisionOccurred = BallGoalCollisionOccurred;
            PlayerInstanceBallCatchAreaVsBallListCollisionCircle.CollisionOccurred          = BallInPlayerRegion;
            PlayerInstanceAxisAlignedRectangleInstanceVsUpSpringCollision.CollisionOccurred =
                (player, collection) => player.YVelocity = PlayerSpringAmount;

            BallListCollisionCircleVsUpSpringCollision.CollisionOccurred =
                (ball, collection) => ball.YVelocity = BallSpringAmount;

            GoalDisplay.AttachTo(Camera.Main);
            GoalDisplay.RelativeZ = -1;
            GoalDisplay.RelativeY = GoalDisplayYOffset;

            TileEntityInstantiator.CreateEntitiesFrom(Map);
        }