public void AreNotEqual_IEquatableImplementationIsIgnored() { var x = new Constraints.EquatableWithEnumerableObject <int>(new[] { 1, 2, 3, 4, 5 }, 42); var y = new Constraints.EnumerableObject <int>(new[] { 5, 4, 3, 2, 1 }, 42); // Equal using Assert Assert.AreEqual(x, y, "Assert 1"); Assert.AreEqual(y, x, "Assert 2"); // Not equal using CollectionAssert CollectionAssert.AreNotEqual(x, y, "CollectionAssert 1"); CollectionAssert.AreNotEqual(y, x, "CollectionAssert 2"); }
public void ShuffleListTest() { var shuffleList = _Testlet.ShuffleList(_ItemsListFixed, 0, 10); if (shuffleList.Count == 10) { CollectionAssert.AreNotEqual(_ItemsListFixed, shuffleList); } else { Assert.Fail(); } }
public void ProbarDatosBajaAlumno() { MantenimientoAlumno mantenimientoAlumno = new GestionAlumno.MantenimientoAlumno(); List <Alumno> misAlumnos = new List <Alumno>(); misAlumnos.Add(mantenimientoAlumno.AltaDatosAlumno("Juana", "Sosa", "1000", new List <string>())); misAlumnos.Add(mantenimientoAlumno.AltaDatosAlumno("Paola", "Bianco", "1001", new List <string>())); misAlumnos.Add(mantenimientoAlumno.AltaDatosAlumno("Hugo", "Cabral", "1002", new List <string>())); misAlumnos.Add(mantenimientoAlumno.AltaDatosAlumno("Alejandra", "Suarez", "1003", new List <string>())); CollectionAssert.AreEqual(misAlumnos, mantenimientoAlumno.GetAlumnos()); mantenimientoAlumno.BajaAlumno("1000"); CollectionAssert.AreNotEqual(misAlumnos, mantenimientoAlumno.GetAlumnos()); }
public void AreNotEqual_Fails() { var set1 = new SimpleObjectCollection("x", "y", "z"); var set2 = new SimpleObjectCollection("x", "y", "z"); var expectedMessage = " Expected: not equal to < \"x\", \"y\", \"z\" >" + Environment.NewLine + " But was: < \"x\", \"y\", \"z\" >" + Environment.NewLine; var ex = Assert.Throws <AssertionException>(() => CollectionAssert.AreNotEqual(set1, set2)); Assert.That(ex.Message, Is.EqualTo(expectedMessage)); }
public void RandomSampelTest3() { var geneSet = new[] { 1, 2, 3 }; int[] gene; do { gene = Rand.RandomSample(geneSet, geneSet.Length).ToArray(); } while (gene.SequenceEqual(geneSet)); CollectionAssert.AreEqual(new[] { 1, 2, 3 }, geneSet); CollectionAssert.AreNotEqual(new[] { 1, 2, 3 }, gene); }
public void GivenAnArrayAndTarget_WhenRun4_ThenReturnsIndicies(int[] nums, int target, int[] expectedResult, bool valid) { var result = this._Sut.Run4(nums, target); if (valid) { CollectionAssert.AreEqual(result, expectedResult); } else { CollectionAssert.AreNotEqual(result, expectedResult); } }
public void checkSplitingMethod() { string[] afterSplitAsColen = HotelRoomReservation.splitDataAsGivenCharacter("type:date,date", ':'); string[] afterSplitAsComma = HotelRoomReservation.splitDataAsGivenCharacter("date,date", ','); string[] afterSplitAsSlash = HotelRoomReservation.splitDataAsGivenCharacter("23/7/2018", '/'); CollectionAssert.AreEqual(new string[] { "type", "date,date" }, afterSplitAsColen); CollectionAssert.AreNotEqual(new string[] { "type:", "date,date" }, afterSplitAsColen); CollectionAssert.AreEqual(new string[] { "date", "date" }, afterSplitAsComma); CollectionAssert.AreNotEqual(new string[] { "date,", "date," }, afterSplitAsComma); CollectionAssert.AreEqual(new string[] { "23", "7", "2018" }, afterSplitAsSlash); CollectionAssert.AreNotEqual(new string[] { "7", "23", "2018" }, afterSplitAsSlash); }
public void A_Invoke_Static() { // Arrange var ee = new EventHandler(); new A(ee); // Act var result = ee.Acquire <bool>("StaticUpdate"); // Assert CollectionAssert.AreNotEqual(new[] { true }, result.ToArray()); }
public void GetReleaseByNumber_ComparerDeuxDisquesAleatoire_Vrai() { //Arrange //creation des variable pour le test sbyte numberRelease = 1; //Act var res1 = serviceTrait.GetReleaseByNumber(numberRelease, colRelease); var res2 = serviceTrait.GetReleaseByNumber(numberRelease, colRelease); //Assert CollectionAssert.AreNotEqual(res1, res2); }
public void CertKeyEncryptionE2E() { byte[] toEncrypt = new byte[] { 1, 2, 3, 4 }; ManagedRSAEncryption managed = new ManagedRSAEncryption(); X509Certificate2 testCert = new X509Certificate2(Convert.FromBase64String(TestCertBase64Encoded), TestCertPassword); byte[] encrypted = managed.EncryptWithCertificate(toEncrypt, testCert); byte[] decrypted = managed.DecryptWithCertificate(encrypted, testCert); CollectionAssert.AreNotEqual(toEncrypt, encrypted); CollectionAssert.AreNotEqual(encrypted, decrypted); CollectionAssert.AreEqual(toEncrypt, decrypted); }
private void ValidateEncryptedData(MemoryStream cb, MemoryStream plaintext) { var sourceBytes = testData.ToArray(); var encryptedBytes = cb.ToArray(); var decryptedBytes = plaintext.ToArray(); CollectionAssert.AreEqual(sourceBytes, decryptedBytes); CollectionAssert.AreNotEqual(sourceBytes, encryptedBytes); var text = Encoding.UTF8.GetString(decryptedBytes); Assert.AreEqual(testContents, text); }
public void deleteTest() { List <Order> orderList = new List <Order>() { new Order(10002, "Tomi", "Wuhan", "hat", 252, 2), new Order(10011, "hekang", "Changsha", "hhh", 12, 5) }; OrderService orderService = new OrderService(); orderService.delete(10011); CollectionAssert.AreNotEqual(orderList, orderService.orderList); }
public void Hashers_SHA512() { EnhancedMemoryStream ms; byte[] data; byte[] digest1, digest2; digest1 = SHA512Hasher.Compute(new byte[] { 0, 1, 2, 3 }, 0, 4); Assert.AreEqual(64, digest1.Length); Assert.AreEqual(64, SHA512Hasher.DigestSize); digest2 = SHA512Hasher.Compute(new byte[] { 1, 1, 2, 3 }, 0, 4); CollectionAssert.AreNotEqual(digest1, digest2); digest1 = SHA512Hasher.Compute(new byte[0]); Assert.AreEqual(64, digest1.Length); Assert.AreEqual(64, SHA512Hasher.DigestSize); digest1 = SHA512Hasher.Compute(new byte[] { 0, 1, 2, 3 }); ms = new EnhancedMemoryStream(); ms.Seek(0, SeekOrigin.Begin); ms.Write(new byte[] { 0, 1, 2, 3 }, 0, 4); ms.Seek(0, SeekOrigin.Begin); digest2 = SHA512Hasher.Compute(ms, 4); CollectionAssert.AreEqual(digest1, digest2); Assert.AreEqual(64, digest2.Length); Assert.AreEqual(0, ms.Position); data = new byte[2048]; for (int i = 0; i < data.Length; i++) { data[i] = (byte)i; } digest1 = SHA512Hasher.Compute(data); ms.Seek(0, SeekOrigin.Begin); ms.Write(data, 0, data.Length); ms.Seek(0, SeekOrigin.Begin); digest2 = SHA512Hasher.Compute(ms, data.Length); CollectionAssert.AreEqual(digest1, digest2); Assert.AreEqual(64, digest2.Length); Assert.AreEqual(0, ms.Position); digest1 = SHA512Hasher.Compute("hello"); digest2 = SHA512Hasher.Compute("world"); CollectionAssert.AreNotEqual(digest1, digest2); CollectionAssert.AreEqual(digest1, SHA512Hasher.Compute("hello")); }
public void ListCopy() { // ARRAGE BClass c1 = new BClass() { id = 69, Age = 23, Name = "Bloodthirst" }; BClass c2 = new BClass() { id = 420, Age = 33, Name = "Ketsueki" }; List <BClass> lst = new List <BClass>() { c1, c2 }; Stopwatch profile = new Stopwatch(); // ACT profile.Start(); List <BClass> copy = listCopier.Copy(lst); profile.Stop(); TestContext.Out.WriteLine($"Time for copying {nameof(List<BClass>)} : { profile.ElapsedTicks } ticks = { profile.ElapsedMilliseconds } ms "); // ASSERT Assert.AreNotSame(lst, copy); Assert.AreEqual(lst.Count, copy.Count); if (lst.Count != copy.Count) { return; } for (int i = 0; i < lst.Count; i++) { Assert.AreNotSame(lst[i], copy[i]); } CollectionAssert.AreNotEqual(lst, copy); CollectionAssert.IsNotSubsetOf(lst, copy); }
public void Program_SearchStationNotFound_ReturnsEmpty() { // Arrange char?charInput = 'p'; // Act SearchHelper.InputChecks(ref charInput, ref _sb); var currentStations = SearchHelper.SearchForStation(_sb.ToString().ToLower(), _stationList); // Assert CollectionAssert.AreNotEqual(_stationList, currentStations); Assert.AreEqual(currentStations.Count, 0); }
public void TryWriteBytes_ChangedBaseOnIpAddress() { IUserIdentityProvider provider = new IpBasedUserIdentityProvider(); HttpContext context1 = HttpContextHelper.GetContextWithIp("192.168.0.2"); HttpContext context2 = HttpContextHelper.GetContextWithIp("127.0.0.2"); byte[] hash1 = GetIdentity(provider, context1); byte[] hash2 = GetIdentity(provider, context2); CollectionAssert.AreNotEqual(hash1, hash2); CollectionAssert.AreEqual(hash1, GetIdentity(provider, context1)); CollectionAssert.AreEqual(hash2, GetIdentity(provider, context2)); }
public void Should_get_different_results_for_different_time_periods() { var model1 = new TopCommitters(); model1.TimePeriod = TimePeriod.PastDay; model1.Load(() => { }); var list1 = model1.Committers; model1.TimePeriod = TimePeriod.PastWeek; model1.Load(() => { }); var list2 = model1.Committers; CollectionAssert.AreNotEqual(list1, list2); }
public void Modern_StreamTest_Key() { Stream str = new Stream(Utility.EnglishAlphabetAsStrings()); str.Key = new byte[] { 0xC1, 0xF2, 0x03, 0xA4, 0x05, 0x06, 0xB7, 0x08 }; string[] cipher = str.Encrypt("A B C D E F".Split(' ')); CollectionAssert.AreNotEqual("A B C D E F".Split(' '), cipher); string[] clear = str.Encrypt(cipher); CollectionAssert.AreEqual("A B C D E F".Split(' '), clear); }
public void TestEncryptSingleBlock_DifferentIv() { PlainFileKey pfk = TestUtilities.ReadTestResource <PlainFileKey>(TestResources.plain_file_key_bad_iv); byte[] ft = Convert.FromBase64String(pfk.Tag); byte[] pfc = Convert.FromBase64String(TestResources.plain_file); byte[] efc = Convert.FromBase64String(TestResources.enc_file); PlainDataContainer testPdc = new PlainDataContainer(pfc); EncryptedDataContainer testEdc = TestEncryptSingleBlock(pfk, testPdc); CollectionAssert.AreNotEqual(efc, testEdc.Content, "File content does match!"); CollectionAssert.AreNotEqual(ft, testEdc.Tag, "File tag does match!"); }
public void NextPrime_AreNotEqual() { int[] expResult = new int[] { 5, 7, 11 }; int nr = 5; int[] input = PrimeHandler.NextPrime(nr); CollectionAssert.AreNotEqual(expResult, input); }
public void Modern_StreamTest_LFSR() { Stream str = new Stream(Utility.EnglishAlphabetAsStrings()); str.Registers = new Components.LinearFeedbackShiftRegister(0xACE1, 16);//key is effectively 0xACE1 string[] cipher = str.Encrypt("A B C D E F".Split(' ')); CollectionAssert.AreNotEqual("A B C D E F".Split(' '), cipher); str.Registers = new Components.LinearFeedbackShiftRegister(0xACE1, 16);//key is effectively 0xACE1 string[] clear = str.Decrypt(cipher); CollectionAssert.AreEqual("A B C D E F".Split(' '), clear); }
public void ProtectedKey_ProtectKeyWithSpecificLength() { var originalKey = KeyGeneration.GenerateRandomKey(20); var originalCopy = new byte[32]; Array.Copy(originalKey, originalCopy, 20); ProtectedMemory.Protect(originalCopy, MemoryProtectionScope.SameProcess); CollectionAssert.AreNotEqual(originalKey, originalCopy); var pk = InMemoryKey.CreateProtectedKeyFromPreProtectedMemory(originalCopy, 20, MemoryProtectionScope.SameProcess); CollectionAssert.AreEqual(originalKey, pk.GetCopyOfKey(), "The unprotected plain key and the original key don't match"); }
public void MutateMoveTest() { var save = new List <Rule> { new DiagonalContentFilter(null, null), new DiagonalOppositeFilter(null), new RowOppositeFilter(null) }; var genes = save.ToList(); Assert.IsTrue(TicTacToeTests.MutateMove(genes)); CollectionAssert.AreNotEqual(save, genes); }
public void ReadAllBytes() { var source1 = new Byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }; var source2 = new Byte[] { }; var memoryStream1 = new MemoryStream(source1, false); var memoryStream2 = new MemoryStream(source2, false); CollectionAssert.AreEqual(memoryStream1.ReadAllBytes(), source1); CollectionAssert.AreEqual(memoryStream2.ReadAllBytes(), source2); memoryStream1.Position = 0; memoryStream2.Position = 0; CollectionAssert.AreNotEqual(memoryStream2.ReadAllBytes(), source1); CollectionAssert.AreNotEqual(memoryStream1.ReadAllBytes(), source2); }
public void DeserializeTest() { byte[] _buffer = ProtoBufHelper.Serialize(personList); List <Person> _actual = ProtoBufHelper.Deserialize <List <Person> >(_buffer); CollectionAssert.AreNotEqual(_actual, personList); _buffer = ProtoBufHelper.Serialize(personList[0]); Person _actualPerson = ProtoBufHelper.Deserialize <Person>(_buffer); Assert.IsNotNull(_actualPerson); ProtoBufHelper.Serialize(personList, serializeFilePath); _actual = ProtoBufHelper.Deserialize <List <Person> >(serializeFilePath); CollectionAssert.AreNotEqual(_actual, personList); }
public void TestThatAtLeastOneGeneIsChanged() { const int left = 1; const int right = 5; var initialGenes = new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; var unchangedGenes = (double[])initialGenes.Clone(); var individual = new Individual { Weights = initialGenes }; scrambleMutation.ApplyScrambleMutation(individual, left, right); CollectionAssert.AreNotEqual(unchangedGenes, individual.Weights); }
public void MultipleParellelThreadsGenerateUniqueSequences(int threadCount, int sequenceLength) { var results = new int[threadCount][]; Parallel.For(0, results.Length, i => results[i] = GenerateArray(sequenceLength, Rng.Next)); for (var i = 0; i < results.Length - 1; i++) { for (var j = i + 1; j < results.Length - 1; j++) { CollectionAssert.AreNotEqual(results[i], results[j]); } } }
public void EnquiryOrderByCustomerTest1() { Order order = new Order(1, DateTime.Now, "1", "1"); OrderItem orderItem = new OrderItem("1", 1, 1); order.orderItems.Add(orderItem); OrderService.orders.Add(order); List <Order> enquiriedOrders = new List <Order>(); bool isOk; enquiriedOrders = OrderService.EnquiryOrderByItem("2", out isOk); Assert.IsFalse(isOk); CollectionAssert.AreNotEqual(enquiriedOrders, OrderService.orders); }
public void TestDelayRange() { int start = 4; int total = 2; IEnumerable <int> deferred = Enumerable.Range(start, total); start = 1; total = 3; IList <int> concrete = deferred.ToList(); Assert.AreEqual(2, concrete.Count); CollectionAssert.AreEqual(new[] { 4, 5 }, concrete); CollectionAssert.AreNotEqual(new[] { 1, 2, 3 }, concrete); }
public void NumeralOrdering() { var unicodeBasedOrder = ChineseNumerals.NormalChineseNumerals.OrderBy(n => n); var numeralNaturalOrder = ChineseNumerals.NormalChineseNumerals.Select(n => n.ToString()) .OrderBy(n => n, ChineseNumerialsComparator.Instance).Select(s => s.First()).ToList(); Console.WriteLine(string.Join(", ", unicodeBasedOrder)); Console.WriteLine(string.Join(", ", numeralNaturalOrder)); CollectionAssert.AreNotEqual(unicodeBasedOrder, ChineseNumerals.NormalChineseNumerals); CollectionAssert.AreEqual(numeralNaturalOrder, ChineseNumerals.NormalChineseNumerals); }