public void AddTask() { List<ParentTask> result1 = ObjBl.GetAllParentTasks(); ParentTask obj1 = result1.Find(x => x.Parent_Task == "Task New Parent"); parentTaskIdDummy = obj1.ParentId; List<User> result2 = ObjBl.GetAllUsers(); User obj2 = result2.Find(x => x.FirstName == "Nivy Updated"); userIdDummy = obj2.UserId; List<Project> result3 = ObjBl.GetAllProjects(); Project obj3 = result3.Find(x => x.ProjectName == "Project updated"); projectIdDummy = obj3.ProjectId; Task obj = new Task(); obj.TaskId = 0; obj.TaskName= "Task New"; obj.ParentId = parentTaskIdDummy; obj.IsParent = false; obj.Project_ID = projectIdDummy; obj.TaskStartDate = DateTime.Now; obj.TaskEndDate = DateTime.Now; obj.Priority = 3; obj.User_ID = userIdDummy; try { ObjBl.AddTask(obj); Assert.IsTrue(1 == 1); } catch { Assert.Inconclusive("Task not added"); } }
public void TestToString_AllPossibleTypes_Success() { #if MONO Assert.Inconclusive("Mono Regex causes StackOverflow... "); #endif TestToStringCore( MessagePackObject.Nil, true, false, 1, -1, SByte.MinValue, Byte.MaxValue, Int16.MinValue, UInt16.MaxValue, Int32.MinValue, UInt32.MaxValue, Int64.MinValue, UInt64.MaxValue, Single.MaxValue, Single.Epsilon, Single.MinValue, Single.NaN, Single.PositiveInfinity, Single.NegativeInfinity, Double.MaxValue, Double.Epsilon, Double.MinValue, Double.NaN, Double.PositiveInfinity, Double.NegativeInfinity, String.Empty, new String('A', 1), new String('A', 31), new String('A', 32), new String('A', 0xFFFF), new String('A', 0x10000), new byte[0], new byte[] { 0xFF }, Enumerable.Repeat(( byte )0xFF, 31).ToArray(), Enumerable.Repeat(( byte )0xFF, 32).ToArray(), Enumerable.Repeat(( byte )0xFF, 0xFFFF).ToArray(), Enumerable.Repeat(( byte )0xFF, 0x10000).ToArray(), new MessagePackObject[0], new MessagePackObject[] { 1 }, Enumerable.Repeat(( MessagePackObject )1, 31).ToArray(), Enumerable.Repeat(( MessagePackObject )1, 32).ToArray(), Enumerable.Repeat(( MessagePackObject )1, 0xFFFF).ToArray(), Enumerable.Repeat(( MessagePackObject )1, 0x10000).ToArray(), new MessagePackObject(new MessagePackObjectDictionary()), new MessagePackObject(new MessagePackObjectDictionary() { { 1, 1 } }), new MessagePackObject(new MessagePackObjectDictionary(Enumerable.Range(1, 15).ToDictionary(i => new MessagePackObject(i), i => new MessagePackObject(i)))), new MessagePackObject(new MessagePackObjectDictionary(Enumerable.Range(1, 16).ToDictionary(i => new MessagePackObject(i), i => new MessagePackObject(i)))), new MessagePackObject(new MessagePackObjectDictionary(Enumerable.Range(1, 0xFFFF).ToDictionary(i => new MessagePackObject(i), i => new MessagePackObject(i)))), new MessagePackObject(new MessagePackObjectDictionary(Enumerable.Range(1, 0x10000).ToDictionary(i => new MessagePackObject(i), i => new MessagePackObject(i)))) ); }
private IEnumerator ValidateTestDependency() { AsyncOperationHandle <IList <IResourceLocation> > locationsHandle = default(AsyncOperationHandle <IList <IResourceLocation> >); try { locationsHandle = Addressables.LoadResourceLocationsAsync("TestAddressablePrefab"); } catch (Exception e) { Assert.Inconclusive("You need to set TestAddressablePrefab key to run this test"); yield break; } while (!locationsHandle.IsDone) { yield return(null); } var locations = locationsHandle.Result; if (locations == null || locations.Count == 0) { Assert.Inconclusive("You need to set TestAddressablePrefab key to run this test"); } var resourceLocation = locations[0]; if (resourceLocation.ResourceType != typeof(GameObject)) { Assert.Inconclusive("TestAddressablePrefab should be a GameObject"); } addressablePrefabReference = new AssetReferenceT <GameObject>(resourceLocation.PrimaryKey); }
public void TestAsString1_EncodingIsNotUtf32_SpecifyUtf32_Fail() { #if MONO Assert.Inconclusive("UTF32Encoding does not throw exception on Mono FCL."); #endif var target = new MessagePackObject(new byte[] { 0xFF }); Assert.Throws <InvalidOperationException>(() => target.AsString(new UTF32Encoding(bigEndian: false, byteOrderMark: false, throwOnInvalidCharacters: true))); }
public void TestUnpackString_ByteArray_Encoding_1ByteNonSpecifiedString() { #if MONO Assert.Inconclusive("UTF32Encoding does not throw exception on Mono FCL."); #elif !NETFX_CORE Assert.Throws <MessageTypeException>(() => Unpacking.UnpackString(new byte[] { 0xA4, 0x7F, 0x7F, 0x7F, 0x7F }, new UTF32Encoding(bigEndian: true, byteOrderMark: false, throwOnInvalidCharacters: true))); #else Assert.Throws <MessageTypeException>(() => Unpacking.UnpackString(new byte[] { 0xA5, 0xF8, 0x88, 0x80, 0x80, 0x80 }, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true))); #endif }
public void EndTask() { try { List<Task> result3 = ObjBl.GetAllTasks(); Task obj3 = result3.Find(x => x.TaskName == "Task New updated"); taskIdDummy = obj3.TaskId; ObjBl.EndTask(taskIdDummy); Assert.IsTrue(1 == 1); } catch { Assert.Inconclusive("Task not ended"); } }
public void AddParentTask() { ParentTask obj = new ParentTask(); obj.Parent_Task = "Task New Parent"; try { ObjBl.AddParentTask(obj); Assert.IsTrue(1 == 1); } catch { Assert.Inconclusive("Parent Task not added"); } }
public void DeleteUser() { try { List<User> result2 = ObjBl.GetAllUsers(); User obj2 = result2.Find(x => x.FirstName == "Nivy Updated"); userIdDummy = obj2.UserId; ObjBl.DeleteUser(userIdDummy); Assert.IsTrue(1 == 1); } catch { Assert.Inconclusive("USer not deleted"); } }
public void DeleteProject() { try { List<Project> result4 = ObjBl.GetAllProjects(); Project obj4 = result4.Find(x => x.ProjectName == "Project updated"); projectIdDummy = obj4.ProjectId; ObjBl.DeleteTask(projectIdDummy); Assert.IsTrue(1 == 1); } catch { Assert.Inconclusive("Project not deleted"); } }
private static void CheckEpsilonComparison() { // Use Equals instead of == to avoid compiler optmization for constant expression if (Double.Epsilon.Equals(0.0)) { // Xamarin iOS comes here. Assert.Inconclusive("Comparison of Double.Epsilon cannot be checked on this platform."); } // Use Equals instead of == to avoid compiler optmization for constant expression if (Single.Epsilon.Equals(0.0f)) { // Xamarin iOS comes here. Assert.Inconclusive("Comparison of Single.Epsilon cannot be checked on this platform."); } }
public void AddUser() { User obj = new User(); obj.UserId = 0; obj.FirstName = "Nivi"; obj.LastName = "Pauly"; obj.EmployeeId = 3488; try { ObjBl.AddUser(obj); Assert.IsTrue(1 == 1); } catch { Assert.Inconclusive("USer not added"); } }
public void TestUnpackString_Stream_Encoding_1ByteNonSpecifiedString() { #if MONO || XAMDROID Assert.Inconclusive("UTF32Encoding does not throw exception on Mono FCL."); #endif #if !NETFX_CORE && !SILVERLIGHT using (var stream = new MemoryStream(new byte[] { 0xA4, 0x7F, 0x7F, 0x7F, 0x7F })) { Assert.Throws <MessageTypeException>(() => Unpacking.UnpackString(stream, new UTF32Encoding(bigEndian: true, byteOrderMark: false, throwOnInvalidCharacters: true))); } #else using (var stream = new MemoryStream(new byte[] { 0xA5, 0xF8, 0x88, 0x80, 0x80, 0x80 })) { Assert.Throws <MessageTypeException>(() => Unpacking.UnpackString(stream, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true))); } #endif // !NETFX_CORE && !SILVERLIGHT }
public void UpdateUser() { List<User> result = ObjBl.GetAllUsers(); User obj1 = result.Find(x => x.FirstName == "Nivi"); userIdDummy = obj1.UserId; User obj = new User(); obj.UserId = userIdDummy; obj.FirstName = "Nivy Updated"; obj.LastName = "Paul"; obj.EmployeeId = 3488; try { ObjBl.UpdateUser(obj); Assert.IsTrue(1 == 1); } catch { Assert.Inconclusive("USer not updated"); } }
public void AddProject() { List<User> result = ObjBl.GetAllUsers(); User obj1 = result.Find(x => x.FirstName == "Nivy Updated"); userIdDummy = obj1.UserId; Project obj = new Project(); obj.ProjectName = "Project New"; obj.User_ID = userIdDummy; obj.ProjectStartDate = DateTime.Now; obj.ProjectEndDate = DateTime.Now; obj.Priority = 1; try { ObjBl.AddProject(obj); Assert.IsTrue(1 == 1); } catch { Assert.Inconclusive("Project not added"); } }
public void UpdateProject() { List<Project> result = ObjBl.GetAllProjects(); Project obj1 = result.Find(x => x.ProjectName == "Project New"); projectIdDummy = obj1.ProjectId; Project obj = new Project(); obj.ProjectId = projectIdDummy; obj.ProjectName = "Project updated"; obj.User_ID = 1; obj.ProjectStartDate = DateTime.Now; obj.ProjectEndDate = DateTime.Now; obj.Priority = 1; try { ObjBl.AddProject(obj); Assert.IsTrue(1 == 1); } catch { Assert.Inconclusive("Project not updated"); } }
public void TestUnpackCharStream_Stream_Encoding_1ByteNonSpecifiedString_ExceptionInReaderOperation() { #if MONO Assert.Inconclusive("UTF32Encoding does not throw exception on Mono FCL."); #endif #if !NETFX_CORE using (var stream = new MemoryStream(new byte[] { 0xA4, 0x7F, 0x7F, 0x7F, 0x7F })) { using (var result = Unpacking.UnpackCharStream(stream, new UTF32Encoding(bigEndian: true, byteOrderMark: false, throwOnInvalidCharacters: true))) { Assert.Throws <DecoderFallbackException>(() => result.Read()); } } #else using (var stream = new MemoryStream(new byte[] { 0xA5, 0xF8, 0x88, 0x80, 0x80, 0x80 })) { using (var result = Unpacking.UnpackCharStream(stream, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true))) { Assert.Throws <DecoderFallbackException>(() => result.Read()); } } #endif }
public void TestToString_AllPossibleTypes_Success() { #if MONO || ENABLE_MONO || (XAMARIN && !AOT) || UNITY Assert.Inconclusive("Mono Regex causes StackOverflow... "); #endif TestToStringCore( MessagePackObject.Nil, true, false, 1, -1, SByte.MinValue, Byte.MaxValue, Int16.MinValue, UInt16.MaxValue, Int32.MinValue, UInt32.MaxValue, Int64.MinValue, UInt64.MaxValue, Single.MaxValue, #if UNITY_WORKAROUND // Epsilon is 0 in Unity Single.Epsilon, #endif // UNITY_WORKAROUND Single.MinValue, Single.NaN, Single.PositiveInfinity, Single.NegativeInfinity, Double.MaxValue, #if UNITY_WORKAROUND // Epsilon is 0 in Unity Double.Epsilon, #endif // UNITY_WORKAROUND Double.MinValue, Double.NaN, Double.PositiveInfinity, Double.NegativeInfinity, String.Empty, new String('A', 1), new String('A', 31), new String('A', 32), new String('A', 0xFFFF), new String('A', 0x10000), new byte[0], new byte[] { 0xFF }, Enumerable.Repeat(( byte )0xFF, 31).ToArray(), Enumerable.Repeat(( byte )0xFF, 32).ToArray(), Enumerable.Repeat(( byte )0xFF, 0xFFFF).ToArray(), Enumerable.Repeat(( byte )0xFF, 0x10000).ToArray(), new MessagePackObject[0], new MessagePackObject[] { 1 }, Enumerable.Repeat(( MessagePackObject )1, 31).ToArray(), Enumerable.Repeat(( MessagePackObject )1, 32).ToArray(), Enumerable.Repeat(( MessagePackObject )1, 0xFFFF).ToArray(), Enumerable.Repeat(( MessagePackObject )1, 0x10000).ToArray(), new MessagePackObject(new MessagePackObjectDictionary()), new MessagePackObject(new MessagePackObjectDictionary() { { 1, 1 } }), new MessagePackObject(new MessagePackObjectDictionary(Enumerable.Range(1, 15).ToDictionary(i => new MessagePackObject(i), i => new MessagePackObject(i), MessagePackObjectEqualityComparer.Instance))), new MessagePackObject(new MessagePackObjectDictionary(Enumerable.Range(1, 16).ToDictionary(i => new MessagePackObject(i), i => new MessagePackObject(i), MessagePackObjectEqualityComparer.Instance))), new MessagePackObject(new MessagePackObjectDictionary(Enumerable.Range(1, 0xFFFF).ToDictionary(i => new MessagePackObject(i), i => new MessagePackObject(i), MessagePackObjectEqualityComparer.Instance))), new MessagePackObject(new MessagePackObjectDictionary(Enumerable.Range(1, 0x10000).ToDictionary(i => new MessagePackObject(i), i => new MessagePackObject(i), MessagePackObjectEqualityComparer.Instance))) ); }
internal static void Verify <T>(T expected, T actual) { if (expected == null) { Assert.That(actual, Is.Null); return; } #if !NETFX_CORE if (expected.GetType().IsGenericType&& expected.GetType().GetGenericTypeDefinition() == typeof(ArraySegment <>)) #else if (expected.GetType().GetTypeInfo().IsGenericType&& expected.GetType().GetGenericTypeDefinition() == typeof(ArraySegment <>)) #endif { AssertArraySegmentEquals(expected, actual); return; } if (expected is DateTime) { Assert.That( MillisecondsDateTimeComparer.Instance.Equals(( DateTime )( object )expected, ( DateTime )( object )actual), "Expected:{1}({2},{3}){0}Actual :{4}({5},{6})", Environment.NewLine, expected, expected == null ? "(null)" : expected.GetType().FullName, (( DateTime )( object )expected).Kind, actual, actual == null ? "(null)" : actual.GetType().FullName, (( DateTime )( object )actual).Kind ); return; } else if (expected is DateTimeOffset) { Assert.That( MillisecondsDateTimeOffsetComparer.Instance.Equals(( DateTimeOffset )( object )expected, ( DateTimeOffset )( object )actual), "Expected:{1}({2}){0}Actual :{3}({4})", Environment.NewLine, expected, expected == null ? "(null)" : expected.GetType().FullName, actual, actual == null ? "(null)" : actual.GetType().FullName ); return; } if (expected is IDictionary) { var actuals = ( IDictionary )actual; foreach (DictionaryEntry entry in (( IDictionary )expected)) { Assert.That(actuals.Contains(entry.Key), "'{0}' is not in '[{1}]'", entry.Key, String.Join(", ", actuals.Keys.OfType <object>().Select(o => o == null ? String.Empty : o.ToString()).ToArray())); Verify(entry.Value, actuals[entry.Key]); } return; } if (expected is IEnumerable) { var expecteds = (( IEnumerable )expected).Cast <Object>().ToArray(); var actuals = (( IEnumerable )actual).Cast <Object>().ToArray(); Assert.That(expecteds.Length, Is.EqualTo(actuals.Length)); for (int i = 0; i < expecteds.Length; i++) { Verify(expecteds[i], actuals[i]); } return; } #if !NETFX_35 if (expected is IStructuralEquatable) { Assert.That( (( IStructuralEquatable )expected).Equals(actual, EqualityComparer <object> .Default), "Expected:{1}({2}){0}Actual :{3}({4})", Environment.NewLine, expected, expected == null ? "(null)" : expected.GetType().FullName, actual, actual == null ? "(null)" : actual.GetType().FullName ); return; } #endif if (expected is FILETIME) { var expectedFileTime = ( FILETIME )( object )expected; var actualFileTime = ( FILETIME )( object )actual; Verify( DateTime.FromFileTimeUtc(((( long )expectedFileTime.dwHighDateTime) << 32) | (expectedFileTime.dwLowDateTime & 0xffffffff)), DateTime.FromFileTimeUtc(((( long )actualFileTime.dwHighDateTime) << 32) | (actualFileTime.dwLowDateTime & 0xffffffff)) ); return; } #if !NETFX_CORE if (expected.GetType().IsGenericType&& expected.GetType().GetGenericTypeDefinition() == typeof(KeyValuePair <,>)) #else if (expected.GetType().GetTypeInfo().IsGenericType&& expected.GetType().GetGenericTypeDefinition() == typeof(KeyValuePair <,>)) #endif { #if !NETFX_35 Verify((( dynamic )expected).Key, (( dynamic )actual).Key); Verify((( dynamic )expected).Value, (( dynamic )actual).Value); #else Assert.Inconclusive(".NET 3.5 does not support dynamic."); #endif return; } if (expected is DictionaryEntry) { var expectedEntry = ( DictionaryEntry )( object )expected; var actualEntry = ( DictionaryEntry )( object )actual; if (expectedEntry.Key == null) { Assert.That((( MessagePackObject )actualEntry.Key).IsNil); } else { Verify(( MessagePackObject )expectedEntry.Key, ( MessagePackObject )actualEntry.Key); } if (expectedEntry.Value == null) { Assert.That((( MessagePackObject )actualEntry.Value).IsNil); } else { Verify(( MessagePackObject )expectedEntry.Value, ( MessagePackObject )actualEntry.Value); } return; } Assert.That( EqualityComparer <T> .Default.Equals(expected, actual), "Expected:{1}({2}){0}Actual :{3}({4})", Environment.NewLine, expected, expected == null ? "(null)" : expected.GetType().FullName, actual, actual == null ? "(null)" : actual.GetType().FullName ); }
/// <summary> /// Throws an <see cref="InconclusiveException"/> with the message that is /// passed in. This causes the test to be reported as inconclusive. /// </summary> /// <param name="message">The message to initialize the <see cref="InconclusiveException"/> with.</param> static public void Inconclusive(string message) { Assert.Inconclusive(message, null); }
/// <summary> /// Throws an <see cref="InconclusiveException"/>. /// This causes the test to be reported as Inconclusive. /// </summary> static public void Inconclusive() { Assert.Inconclusive(string.Empty, null); }