Beispiel #1
0
        public void ParseAppSecretNoEquals()
        {
            var appSecret    = Guid.NewGuid().ToString();
            var parsedSecret = AppCenter.GetSecretAndTargetForPlatform(appSecret, "uwp");

            Assert.AreEqual(appSecret, parsedSecret);
        }
        public void ParseWithEqualInSecret()
        {
            var platformId   = "uwp";
            var secrets      = $"ios=anotherstring;{platformId}=123=456";
            var parsedSecret = AppCenter.GetSecretAndTargetForPlatform(secrets, platformId);

            Assert.AreEqual("123=456", parsedSecret);
        }
Beispiel #3
0
 public void ThrowWhenBothKeysAreEmpty()
 {
     var appSecret    = string.Empty;
     var targetToken  = string.Empty;
     var platformId   = "ios";
     var secrets      = $"{platformId}={appSecret};{platformId}Target={targetToken}";
     var parsedSecret = AppCenter.GetSecretAndTargetForPlatform(secrets, platformId);
 }
        public void ParsingFailIfWhiteSpaceBeforeFirstSecret()
        {
            var appSecret    = Guid.NewGuid().ToString();
            var platformId   = "uwp";
            var secrets      = $" {platformId}={appSecret};ios=anotherstring";
            var parsedSecret = AppCenter.GetSecretAndTargetForPlatform(secrets, platformId);

            Assert.AreNotEqual(appSecret, parsedSecret);
        }
        public void ParseAppSecretSecondOfTwoWithoutDelimiterButWhiteSpace()
        {
            var appSecret    = Guid.NewGuid().ToString();
            var platformId   = "uwp";
            var secrets      = $"ios=anotherstring;{platformId}={appSecret}\n";
            var parsedSecret = AppCenter.GetSecretAndTargetForPlatform(secrets, platformId);

            Assert.AreNotEqual(appSecret, parsedSecret);
        }
Beispiel #6
0
        public void ParseAppSecretOnePlatformTerminatingSemicolon()
        {
            var appSecret    = Guid.NewGuid().ToString();
            var platformId   = "uwp";
            var secrets      = $"{platformId}={appSecret};";
            var parsedSecret = AppCenter.GetSecretAndTargetForPlatform(secrets, platformId);

            Assert.AreEqual(appSecret, parsedSecret);
        }
Beispiel #7
0
        public void ParseAppSecretWrongIdentifier()
        {
            var appSecret  = Guid.NewGuid().ToString();
            var platformId = "uwp";
            var secrets    = $"ios=anotherstring;{platformId}={appSecret};";

            Assert.ThrowsException <AppCenterException>(
                () => AppCenter.GetSecretAndTargetForPlatform(secrets, platformId + platformId));
        }
Beispiel #8
0
        public void ParseSecretUsesLastValueOnDuplicateKey()
        {
            var appSecret    = Guid.NewGuid().ToString();
            var platformId   = "uwp";
            var secrets      = $"{platformId}={Guid.NewGuid()};{platformId}={appSecret}";
            var parsedSecret = AppCenter.GetSecretAndTargetForPlatform(secrets, platformId);

            Assert.AreEqual(appSecret, parsedSecret);
        }
Beispiel #9
0
 public void ThrowWhenFoundNoneOfTheKeys()
 {
     var invalidePlatformIdentifier = "invalidePlatformIdentifier";
     var appSecret    = Guid.NewGuid().ToString();
     var targetToken  = Guid.NewGuid().ToString();
     var platformId   = "ios";
     var secrets      = $"{platformId}={appSecret};{platformId}Target={targetToken}";
     var parsedSecret = AppCenter.GetSecretAndTargetForPlatform(secrets, invalidePlatformIdentifier);
 }
Beispiel #10
0
        public void ParseAppSecretExtraSemicolons()
        {
            var appSecret    = Guid.NewGuid().ToString();
            var platformId   = "uwp";
            var secrets      = $"ios=anotherstring;;;;{platformId}={appSecret};;;;";
            var parsedSecret = AppCenter.GetSecretAndTargetForPlatform(secrets, platformId);

            Assert.AreEqual(appSecret, parsedSecret);
        }
Beispiel #11
0
        public void ParseValidSecretSurroundedWithInvalidPairs()
        {
            var appSecret    = Guid.NewGuid().ToString();
            var platformId   = "uwp";
            var secrets      = $"=;{platformId}={appSecret};=";
            var parsedSecret = AppCenter.GetSecretAndTargetForPlatform(secrets, platformId);

            Assert.AreEqual(appSecret, parsedSecret);
        }
Beispiel #12
0
        public void NotParseTargetString()
        {
            var targetToken  = Guid.NewGuid().ToString();
            var secrets      = $"target={targetToken};";
            var platformId   = "ios";
            var parsedSecret = AppCenter.GetSecretAndTargetForPlatform(secrets, platformId);

            Assert.AreEqual(secrets, parsedSecret);
        }
Beispiel #13
0
        public void ParseAppSecretFirstOfTwo()
        {
            var appSecret    = Guid.NewGuid().ToString();
            var platformId   = "uwp";
            var secrets      = $"{platformId}={appSecret};ios=anotherstring";
            var parsedSecret = AppCenter.GetSecretAndTargetForPlatform(secrets, platformId);

            Assert.AreEqual(appSecret, parsedSecret);
        }
Beispiel #14
0
        public void ParseTargetToken()
        {
            var targetToken  = Guid.NewGuid().ToString();
            var platformId   = "android";
            var secrets      = $"{platformId}Target={targetToken};";
            var parsedSecret = AppCenter.GetSecretAndTargetForPlatform(secrets, platformId);
            var expected     = $"target={targetToken}";

            Assert.AreEqual(expected, parsedSecret);
        }
Beispiel #15
0
        public void ParseAppSecretAndTargetOnePlatform()
        {
            var appSecret    = Guid.NewGuid().ToString();
            var targetToken  = Guid.NewGuid().ToString();
            var platformId   = "ios";
            var secrets      = $"{platformId}={appSecret};{platformId}Target={targetToken}";
            var parsedSecret = AppCenter.GetSecretAndTargetForPlatform(secrets, platformId);
            var expected     = $"appsecret={appSecret};target={targetToken}";

            Assert.AreEqual(expected, parsedSecret);
        }
        public void ParseAppSecretAndTargetMultiplePlatformWithNewLines()
        {
            var appSecret        = Guid.NewGuid().ToString();
            var anotherAppSecret = Guid.NewGuid().ToString();
            var targetToken      = Guid.NewGuid().ToString();
            var platformId       = "android";
            var secrets          = $"{platformId}={appSecret};\nios={anotherAppSecret};{platformId}Target={targetToken};\niosTarget={anotherAppSecret}";
            var parsedSecret     = AppCenter.GetSecretAndTargetForPlatform(secrets, platformId);
            var expected         = $"appsecret={appSecret};target={targetToken}";

            Assert.AreEqual(expected, parsedSecret);
        }
        public void ParsingFailIfWhiteSpaceBeforeFirstSecret()
        {
            var appSecret  = Guid.NewGuid().ToString();
            var platformId = "uwp";
            var secrets    = $" {platformId}={appSecret};ios=anotherstring";

            try
            {
                AppCenter.GetSecretAndTargetForPlatform(secrets, platformId);
                Assert.Fail("It should be failed.");
            }
            catch (Exception e)
            {
                Assert.AreEqual(e.GetType(), typeof(AppCenterException));
            }
        }
Beispiel #18
0
        public void VerifyPlatformId()
        {
            var appClientId = AppCenter.GetSecretAndTargetForPlatform("windowsdesktop=6a367cda-2c0a-4fb0-bedf-f110bf4e338b", "windowsdesktop");

            Assert.Equal("6a367cda-2c0a-4fb0-bedf-f110bf4e338b", appClientId);
        }