public void TestValidateEventIdLength() { Assert.True(GAValidator.ValidateEventIdLength(GATestUtilities.GetRandomString(40))); Assert.True(GAValidator.ValidateEventIdLength(GATestUtilities.GetRandomString(32))); Assert.True(GAValidator.ValidateEventIdLength("sdfdf")); Assert.False(GAValidator.ValidateEventIdLength(GATestUtilities.GetRandomString(80))); Assert.False(GAValidator.ValidateEventIdLength(null)); Assert.False(GAValidator.ValidateEventIdLength("")); }
public void TestValidateBuild() { Assert.False(GAValidator.ValidateBuild("")); Assert.False(GAValidator.ValidateBuild(null)); Assert.False(GAValidator.ValidateBuild(GATestUtilities.GetRandomString(40))); Assert.True(GAValidator.ValidateBuild("alpha 1.2.3")); Assert.True(GAValidator.ValidateBuild("ALPHA 1.2.3")); Assert.True(GAValidator.ValidateBuild("TES# sdf.fd3")); }
public void TestValidateArrayOfStrings() { Assert.True(GAValidator.ValidateArrayOfStrings(3, 10, false, "test", GATestUtilities.GetRandomString(3), GATestUtilities.GetRandomString(10), GATestUtilities.GetRandomString(7))); Assert.True(GAValidator.ValidateArrayOfStrings(3, 10, true, "test", new string[0])); Assert.False(GAValidator.ValidateArrayOfStrings(3, 10, false, "test", GATestUtilities.GetRandomString(3), GATestUtilities.GetRandomString(12), GATestUtilities.GetRandomString(7))); Assert.False(GAValidator.ValidateArrayOfStrings(3, 10, false, "test", GATestUtilities.GetRandomString(3), "", GATestUtilities.GetRandomString(7))); Assert.False(GAValidator.ValidateArrayOfStrings(3, 10, false, "test", GATestUtilities.GetRandomString(3), null, GATestUtilities.GetRandomString(7))); Assert.False(GAValidator.ValidateArrayOfStrings(2, 10, false, "test", GATestUtilities.GetRandomString(3), GATestUtilities.GetRandomString(10), GATestUtilities.GetRandomString(7))); Assert.False(GAValidator.ValidateArrayOfStrings(3, 10, false, "test", new string[0])); Assert.False(GAValidator.ValidateArrayOfStrings(3, 10, false, "test", (string)null)); }
public void TestValidateLongString() { Assert.True(GAValidator.ValidateLongString(GATestUtilities.GetRandomString(8192), false)); Assert.True(GAValidator.ValidateLongString(GATestUtilities.GetRandomString(8192), true)); Assert.True(GAValidator.ValidateLongString(GATestUtilities.GetRandomString(10), false)); Assert.True(GAValidator.ValidateLongString(GATestUtilities.GetRandomString(10), true)); Assert.True(GAValidator.ValidateLongString(null, true)); Assert.True(GAValidator.ValidateLongString("", true)); Assert.False(GAValidator.ValidateLongString(GATestUtilities.GetRandomString(8193), false)); Assert.False(GAValidator.ValidateLongString(GATestUtilities.GetRandomString(8193), true)); Assert.False(GAValidator.ValidateLongString(null, false)); Assert.False(GAValidator.ValidateLongString("", false)); }
public void TestValidateEventPartLength() { Assert.True(GAValidator.ValidateEventPartLength(GATestUtilities.GetRandomString(40), true)); Assert.True(GAValidator.ValidateEventPartLength(GATestUtilities.GetRandomString(40), false)); Assert.False(GAValidator.ValidateEventPartLength(GATestUtilities.GetRandomString(80), true)); Assert.False(GAValidator.ValidateEventPartLength(GATestUtilities.GetRandomString(80), false)); Assert.False(GAValidator.ValidateEventPartLength(null, false)); Assert.False(GAValidator.ValidateEventPartLength("", false)); Assert.True(GAValidator.ValidateEventPartLength("", true)); Assert.True(GAValidator.ValidateEventPartLength("sdfdf", false)); Assert.True(GAValidator.ValidateEventPartLength(null, true)); Assert.True(GAValidator.ValidateEventPartLength(GATestUtilities.GetRandomString(32), true)); }
public void TestValidateEngineVersion() { Assert.False(GAValidator.ValidateEngineVersion("")); Assert.False(GAValidator.ValidateEngineVersion(null)); Assert.False(GAValidator.ValidateEngineVersion(GATestUtilities.GetRandomString(40))); Assert.False(GAValidator.ValidateEngineVersion("uni 1.2.3")); Assert.False(GAValidator.ValidateEngineVersion("unity 123456.2.3")); Assert.False(GAValidator.ValidateEngineVersion("unity1.2.3")); Assert.False(GAValidator.ValidateEngineVersion("unity 1.2.3.4")); Assert.False(GAValidator.ValidateEngineVersion("Unity 1.2.3")); Assert.False(GAValidator.ValidateEngineVersion("UNITY 1.2.3")); Assert.True(GAValidator.ValidateEngineVersion("unity 1.2.3")); Assert.True(GAValidator.ValidateEngineVersion("unity 1.2")); Assert.True(GAValidator.ValidateEngineVersion("unity 1")); Assert.False(GAValidator.ValidateEngineVersion("marmalade 1.2.3")); Assert.False(GAValidator.ValidateEngineVersion("xamarin 1.2.3")); Assert.False(GAValidator.ValidateEngineVersion("cocos2d 1.2.3")); Assert.False(GAValidator.ValidateEngineVersion("unreal 1.2.3")); }
public void TestValidateAndCleanCustomFields() { IDictionary <string, object> map; { map = new Dictionary <string, object>(); while (map.Count < 100) { string key = GATestUtilities.GetRandomString(4); if (!map.ContainsKey(key)) { map.Add(key, GATestUtilities.GetRandomString(4)); } } } Assert.AreEqual(50, GAState.ValidateAndCleanCustomFields(map).Count); { map = new Dictionary <string, object>(); while (map.Count < 50) { string key = GATestUtilities.GetRandomString(4); if (!map.ContainsKey(key)) { map.Add(key, GATestUtilities.GetRandomString(4)); } } } Assert.AreEqual(50, GAState.ValidateAndCleanCustomFields(map).Count); { map = new Dictionary <string, object>(); map.Add(GATestUtilities.GetRandomString(4), ""); } Assert.AreEqual(0, GAState.ValidateAndCleanCustomFields(map).Count); { map = new Dictionary <string, object>(); map.Add(GATestUtilities.GetRandomString(4), GATestUtilities.GetRandomString(257)); } Assert.AreEqual(0, GAState.ValidateAndCleanCustomFields(map).Count); { map = new Dictionary <string, object>(); map.Add("", GATestUtilities.GetRandomString(4)); } Assert.AreEqual(0, GAState.ValidateAndCleanCustomFields(map).Count); { map = new Dictionary <string, object>(); map.Add("___", GATestUtilities.GetRandomString(4)); } Assert.AreEqual(1, GAState.ValidateAndCleanCustomFields(map).Count); { map = new Dictionary <string, object>(); map.Add("_&_", GATestUtilities.GetRandomString(4)); } Assert.AreEqual(0, GAState.ValidateAndCleanCustomFields(map).Count); { map = new Dictionary <string, object>(); map.Add(GATestUtilities.GetRandomString(65), GATestUtilities.GetRandomString(4)); } Assert.AreEqual(0, GAState.ValidateAndCleanCustomFields(map).Count); { map = new Dictionary <string, object>(); map.Add(GATestUtilities.GetRandomString(4), 100); } Assert.AreEqual(1, GAState.ValidateAndCleanCustomFields(map).Count); { map = new Dictionary <string, object>(); map.Add(GATestUtilities.GetRandomString(4), new object[] { 100 }); map.Add(GATestUtilities.GetRandomString(5), true); } Assert.AreEqual(0, GAState.ValidateAndCleanCustomFields(map).Count); { map = new Dictionary <string, object>(); byte b = 1; sbyte sb = 1; short s = 5; ushort us = 5; float f = 9.99f; int i = 2; uint ui = 2; long l = 1000L; ulong ul = 1000L; double d = 6.66d; char c = 'a'; map.Add(GATestUtilities.GetRandomString(1), b); map.Add(GATestUtilities.GetRandomString(2), sb); map.Add(GATestUtilities.GetRandomString(3), s); map.Add(GATestUtilities.GetRandomString(4), us); map.Add(GATestUtilities.GetRandomString(5), f); map.Add(GATestUtilities.GetRandomString(6), i); map.Add(GATestUtilities.GetRandomString(7), ui); map.Add(GATestUtilities.GetRandomString(8), l); map.Add(GATestUtilities.GetRandomString(9), ul); map.Add(GATestUtilities.GetRandomString(10), d); map.Add(GATestUtilities.GetRandomString(11), c); } Assert.AreEqual(11, GAState.ValidateAndCleanCustomFields(map).Count); }