public void AfterResetting_ThenANewQuestionnaireIsCreated()
        {
            QuestionViewModel[] originalQuestions = null;
            Action <IOperationResult <Questionnaire> > callback = null;

            var repository = new Mock <IQuestionnaireRepository>();

            repository.Setup(r => r.GetQuestionnaireAsync(It.IsAny <Action <IOperationResult <Questionnaire> > >()))
            .Callback <Action <IOperationResult <Questionnaire> > >(c => callback = c);

            var viewModel = new QuestionnaireViewModel(repository.Object);

            callback(CreateQuestionnaireResult());

            originalQuestions = viewModel.Questions.ToArray();

            viewModel.Questionnaire.Name = "TestName";
            viewModel.Questionnaire.Age  = 14;
            AnswerAllQuestions(viewModel);

            viewModel.Reset();

            var tracker = new PropertyChangeTracker(viewModel);

            callback(CreateQuestionnaireResult());

            CollectionAssert.AreNotEquivalent(originalQuestions, viewModel.Questions.ToArray());
            CollectionAssert.Contains(tracker.ChangedProperties, "CanSubmit");
        }
        public void AfterSubmitting_ANewQuestionnaireIsCreated()
        {
            QuestionViewModel[] originalQuestions = null;
            Action <IOperationResult <Questionnaire> > callback = null;
            Action <IOperationResult> submitCallback            = null;

            var repository = new Mock <IQuestionnaireRepository>();

            repository.Setup(r => r.GetQuestionnaireAsync(It.IsAny <Action <IOperationResult <Questionnaire> > >()))
            .Callback <Action <IOperationResult <Questionnaire> > >(c => callback = c);
            repository.Setup(r => r.SubmitQuestionnaireAsync(It.IsAny <Questionnaire>(), It.IsAny <Action <IOperationResult> >()))
            .Callback <Questionnaire, Action <IOperationResult> >(
                (q, sc) => submitCallback = sc);

            var viewModel = new QuestionnaireViewModel(repository.Object);

            callback(CreateQuestionnaireResult());

            originalQuestions = viewModel.Questions.ToArray();

            viewModel.Questionnaire.Name = "TestName";
            viewModel.Questionnaire.Age  = 14;
            AnswerAllQuestions(viewModel);

            viewModel.Submit();
            submitCallback(new Mock <IOperationResult>().Object);
            callback(CreateQuestionnaireResult());

            CollectionAssert.AreNotEquivalent(originalQuestions, viewModel.Questions.ToArray());
        }
Exemple #3
0
        public void PaginationPageLinksTest()
        {
            Init();
            PaginationCommon();
            List <string> linkText2 = new List <string>();
            ReadOnlyCollection <IWebElement> linkItems2 = driver.FindElements(By.CssSelector(".entry-box .entry-title"));

            foreach (IWebElement link in linkItems2)
            {
                linkText2.Add(link.Text);
            }
            driver.Navigate().Back();
            List <string> linkText1 = new List <string>();
            ReadOnlyCollection <IWebElement> linkItems1 = driver.FindElements(By.CssSelector(".entry-box .entry-title"));

            foreach (IWebElement link in linkItems1)
            {
                linkText1.Add(link.Text);
            }
            //Assert by comparing both lists
            CollectionAssert.AreNotEquivalent(linkText1, linkText2);
            //CollectionAssert.AllItemsAreUnique(linkText1, linkText2, "Unique Links");

            Close();
        }
Exemple #4
0
        public void NotEquivalentHandlesNull()
        {
            var set1 = new SimpleObjectCollection("x", null, "z");
            var set2 = new SimpleObjectCollection("x", null, "x");

            CollectionAssert.AreNotEquivalent(set1, set2);
        }
        public void GivenScenariosView_WhenCalculationInputNotifiesObserver_ThenDataGridViewUpdated()
        {
            // Given
            var calculationGroup = new CalculationGroup();

            ShowFullyConfiguredScenariosView(calculationGroup, new TestCalculatableFailureMechanism());

            var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject;

            TestScenarioRow[] sectionResultRows = dataGridView.Rows.Cast <DataGridViewRow>()
                                                  .Select(r => r.DataBoundItem)
                                                  .Cast <TestScenarioRow>()
                                                  .ToArray();

            TestCalculationScenario calculation = calculationGroup.GetCalculations().Cast <TestCalculationScenario>().First();

            // When
            calculation.InputParameters.NotifyObservers();

            // Then
            TestScenarioRow[] updatedRows = dataGridView.Rows.Cast <DataGridViewRow>()
                                            .Select(r => r.DataBoundItem)
                                            .Cast <TestScenarioRow>()
                                            .ToArray();

            CollectionAssert.AreNotEquivalent(sectionResultRows, updatedRows);
        }
        public void TestAddingInstanceHeadersDoesNotModifyGlobal()
        {
            // Arrange
            Configuration.Default.DefaultHeader.Add("Content-Type", "application/json");
            Configuration.Default.ApiKey.Add("api_key_identifier", "1233456778889900");
            Configuration.Default.ApiKeyPrefix.Add("api_key_identifier", "PREFIX");

            Configuration c = new Configuration(
                Configuration.Default.DefaultHeader,
                Configuration.Default.ApiKey,
                Configuration.Default.ApiKeyPrefix
                );

            // sanity
            CollectionAssert.AreEquivalent(c.DefaultHeader, Configuration.Default.DefaultHeader);
            CollectionAssert.AreEquivalent(c.ApiKey, Configuration.Default.ApiKey);
            CollectionAssert.AreEquivalent(c.ApiKeyPrefix, Configuration.Default.ApiKeyPrefix);

            // Act
            Configuration.Default.DefaultHeader["Content-Type"]      = "application/xml";
            Configuration.Default.ApiKey["api_key_identifier"]       = "00000000000001234";
            Configuration.Default.ApiKeyPrefix["api_key_identifier"] = "MODIFIED";

            // Assert
            CollectionAssert.AreNotEquivalent(c.DefaultHeader, Configuration.Default.DefaultHeader);
            CollectionAssert.AreNotEquivalent(c.ApiKey, Configuration.Default.ApiKey);
            CollectionAssert.AreNotEquivalent(c.ApiKeyPrefix, Configuration.Default.ApiKeyPrefix);
        }
        public void GivenScenariosView_WhenFailureMechanismNotifiesObserver_ThenDataGridViewUpdated()
        {
            // Given
            var failureMechanism = new TestCalculatableFailureMechanism();

            ShowFullyConfiguredScenariosView(new CalculationGroup(), failureMechanism);

            var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject;

            TestScenarioRow[] sectionResultRows = dataGridView.Rows.Cast <DataGridViewRow>()
                                                  .Select(r => r.DataBoundItem)
                                                  .Cast <TestScenarioRow>()
                                                  .ToArray();

            // When
            failureMechanism.NotifyObservers();

            // Then
            TestScenarioRow[] updatedRows = dataGridView.Rows.Cast <DataGridViewRow>()
                                            .Select(r => r.DataBoundItem)
                                            .Cast <TestScenarioRow>()
                                            .ToArray();

            CollectionAssert.AreNotEquivalent(sectionResultRows, updatedRows);
        }
        public void GivenScenariosView_WhenSelectingDifferentItemInSectionsListBox_ThenDataGridViewUpdated()
        {
            // Given
            var failureMechanism = new TestCalculatableFailureMechanism();

            ShowFullyConfiguredScenariosView(new CalculationGroup(), failureMechanism);

            var listBox      = (ListBox) new ControlTester("listBox").TheObject;
            var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject;

            // Precondition
            Assert.AreSame(failureMechanism.Sections.First(), listBox.SelectedItem);

            TestScenarioRow[] sectionResultRows = dataGridView.Rows.Cast <DataGridViewRow>()
                                                  .Select(r => r.DataBoundItem)
                                                  .Cast <TestScenarioRow>()
                                                  .ToArray();

            // When
            listBox.SelectedItem = failureMechanism.Sections.Last();

            // Then
            TestScenarioRow[] updatedRows = dataGridView.Rows.Cast <DataGridViewRow>()
                                            .Select(r => r.DataBoundItem)
                                            .Cast <TestScenarioRow>()
                                            .ToArray();

            CollectionAssert.AreNotEquivalent(sectionResultRows, updatedRows);
        }
Exemple #9
0
        public void Test()
        {
            var signer = new XxHashSign(10, 11);

            var payload1   = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
            var signature1 = signer.Sign(new ArraySegment <byte>(payload1));

            Console.WriteLine(signature1.ToHexString());

            Assert.AreEqual(signature1.Length, signer.SignatureBytesCount);
            var expected = "1967874272bef9e1".FromHexString();

            CollectionAssert.AreEquivalent(expected, signature1);

            var payload2   = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 5 };
            var signature2 = signer.Sign(new ArraySegment <byte>(payload2));

            Console.WriteLine(signature2.ToHexString());

            Assert.AreEqual(signature2.Length, signer.SignatureBytesCount);
            CollectionAssert.AreNotEquivalent(signature1, signature2);

            var signature1Alt1 = signer.Sign(new ArraySegment <byte>(payload1));

            CollectionAssert.AreEquivalent(signature1, signature1Alt1);

            var sigAppendedPayload1 = signature1.Concat(payload1).ToArray();
            var signature1Alt2      =
                signer.Sign(new ArraySegment <byte>(sigAppendedPayload1, signer.SignatureBytesCount,
                                                    sigAppendedPayload1.Length - signer.SignatureBytesCount));

            CollectionAssert.AreEquivalent(signature1, signature1Alt2);
        }
        public override void CompareTo(ITypeProcessor other, CompareOp compareOp)
        {
            ICollection otherValue;

            //Console.WriteLine($"***** Comparing {this} {compareOp} {other}");

            switch (compareOp)
            {
            case CompareOp.Null:
                Assert.IsNull(Value);
                break;

            case CompareOp.NotNull:
                Assert.IsNotNull(Value);
                break;

            case CompareOp.Equal:
                otherValue = GetCollectionToCompareTo(other);
                CollectionAssert.AreEqual(otherValue, CollectionValue, Comparer, $"{this} is not equal to {other}");
                break;

            case CompareOp.NotEqual:
                otherValue = GetCollectionToCompareTo(other);
                CollectionAssert.AreNotEqual(otherValue, CollectionValue, Comparer, $"{this} is equal to {other}");
                break;

            case CompareOp.Equivalent:
                otherValue = GetCollectionToCompareTo(other);
                CollectionAssert.AreEquivalent(otherValue, CollectionValue, $"{this} is not equivalent to {other}");
                break;

            case CompareOp.NotEquivalent:
                otherValue = GetCollectionToCompareTo(other);
                CollectionAssert.AreNotEquivalent(otherValue, CollectionValue, $"{this} is equivalent to {other}");
                break;

            case CompareOp.Contain:
                otherValue = GetCollectionToCompareTo(other);
                CollectionAssert.IsSubsetOf(otherValue, CollectionValue, $"{this} does not contain {other}");
                break;

            case CompareOp.NotContain:
                otherValue = GetCollectionToCompareTo(other);
                CollectionAssert.IsNotSubsetOf(otherValue, CollectionValue, $"{this} contains {other}");
                break;

            case CompareOp.Match:
            case CompareOp.NotMatch:
            case CompareOp.Greater:
            case CompareOp.GreaterOrEqual:
            case CompareOp.NotGreater:
            case CompareOp.NotGreaterOrEqual:
            case CompareOp.Less:
            case CompareOp.LessOrEqual:
            case CompareOp.NotLess:
            case CompareOp.NotLessOrEqual:
            default:
                ThrowCompareOpNotSupported(compareOp); break;
            }
        }
        public void DoesNotReturnsBands_WithoutIncludingGenre()
        {
            var contextMock        = new Mock <IMusicLibraryContext>();
            var contextBaseMock    = new Mock <IMusicLibraryBaseContext>();
            var countryServiceMock = new Mock <ICountryService>();
            var genreServiceMock   = new Mock <IGenreService>();
            var userServiceMock    = new Mock <IUserService>();
            var bandFactoryMock    = new Mock <IBandFactory>();
            var bands = GetBands();

            var expectedResult = bands.Where(x => x.Genre.GenreName.Contains("Metal")).AsQueryable();
            var bandsSetMock   = QueryableDbSetMock.GetQueryableMockDbSet(bands);

            contextMock.Setup(x => x.Bands).Returns(bandsSetMock);

            var bandService = new BandService(
                contextMock.Object,
                contextBaseMock.Object,
                countryServiceMock.Object,
                genreServiceMock.Object,
                userServiceMock.Object,
                bandFactoryMock.Object);

            var bandResultSet = bandService.GetAllBands();

            CollectionAssert.AreNotEquivalent(expectedResult, bandResultSet.ToList());
        }
Exemple #12
0
        public void StatsByCategoryReturnCorrectNumberOfUsersPerCategory()
        {
            List <Customer> customers = TestHelpers.GetSampleCustomersList();

            StatsViewModel viewModel = new StatsViewModel(customers);

            viewModel.SelectedStatsType = StatsType.Category;

            List <KeyValuePair <string, decimal> > expectedList = new List <KeyValuePair <string, decimal> >()
            {
                new KeyValuePair <string, decimal>("A", 2),
                new KeyValuePair <string, decimal>("B", 2),
            };

            CollectionAssert.AreEquivalent(expectedList, viewModel.StatsData);

            List <KeyValuePair <string, decimal> > incorrectList = new List <KeyValuePair <string, decimal> >()
            {
                new KeyValuePair <string, decimal>("A", 1),
                new KeyValuePair <string, decimal>("B", 1),
                new KeyValuePair <string, decimal>("C", 1),
            };

            CollectionAssert.AreNotEquivalent(incorrectList, viewModel.StatsData);
        }
Exemple #13
0
        public void ReturnDifferentBills_WhenIdUserIsNotValid()
        {
            // Arrange
            var contextMock        = this.ContextMock;
            var companyServiceMock = this.CompanyServiceMocked;

            var idUser = "******";
            var bills  = this.Bills;

            var billSetMock = QueryableDbSetMock.GetQueryableMockDbSet(bills);

            var expectedResult = bills.Where(b => b.IdUser == "idUser03");


            contextMock.Setup(c => c.Bills).Returns(billSetMock.Object);

            Bills.Services.BillService billService = new Bills.Services.BillService(contextMock.Object, companyServiceMock.Object);

            // Act
            var result = billService.GetBillsByIdUser(idUser);

            // Assert
            contextMock.Verify(b => b.Bills, Times.Once);
            CollectionAssert.IsNotEmpty(expectedResult);
            CollectionAssert.IsEmpty(result);
            CollectionAssert.AreNotEquivalent(expectedResult, result);
        }
        public void CollectionAssertTests()
        {
            List <int> collections = new List <int> {
                1, 2, 3
            };

            CollectionAssert.AllItemsAreInstancesOfType(collections, typeof(int));
            CollectionAssert.AllItemsAreNotNull(collections);
            CollectionAssert.AllItemsAreUnique(collections);
            CollectionAssert.AreEqual(collections, new List <int> {
                1, 2, 3
            });
            CollectionAssert.AreEquivalent(collections, new List <int> {
                3, 2, 1
            });
            CollectionAssert.AreNotEqual(collections, new List <int> {
                3, 2, 1
            });
            CollectionAssert.AreNotEquivalent(collections, new List <int> {
                3, 2
            });
            CollectionAssert.Contains(collections, 1);
            CollectionAssert.DoesNotContain(collections, 4);
            CollectionAssert.IsSubsetOf(new List <int> {
                2, 3
            }, collections);
            CollectionAssert.IsNotSubsetOf(new List <int> {
                4, 3
            }, collections);
        }
Exemple #15
0
        public void StatsByLocationReturnCorrectNumberOfUsersPerLocation()
        {
            List <Customer> customers = TestHelpers.GetSampleCustomersList();

            StatsViewModel viewModel = new StatsViewModel(customers);

            viewModel.SelectedStatsType = StatsType.Location;

            List <KeyValuePair <string, decimal> > expectedList = new List <KeyValuePair <string, decimal> >()
            {
                new KeyValuePair <string, decimal>("United States, Alaska", 2),
                new KeyValuePair <string, decimal>("United States, Florida", 1),
                new KeyValuePair <string, decimal>("United States, Washington", 1),
            };

            CollectionAssert.AreEquivalent(expectedList, viewModel.StatsData);

            List <KeyValuePair <string, decimal> > incorrectList = new List <KeyValuePair <string, decimal> >()
            {
                new KeyValuePair <string, decimal>("UK, Surrey", 1),
                new KeyValuePair <string, decimal>("United States, Florida", 1),
                new KeyValuePair <string, decimal>("United States, Washington", 1),
            };

            CollectionAssert.AreNotEquivalent(incorrectList, viewModel.StatsData);
        }
        public void CollectionEquivalenceTests()
        {
            int[] ints1to5  = new int[] { 1, 2, 3, 4, 5 };
            int[] twothrees = new int[] { 1, 2, 3, 3, 4, 5 };
            int[] twofours  = new int[] { 1, 2, 3, 4, 4, 5 };

            // Classic syntax
            CollectionAssert.AreEquivalent(new int[] { 2, 1, 4, 3, 5 }, ints1to5);
            CollectionAssert.AreNotEquivalent(new int[] { 2, 2, 4, 3, 5 }, ints1to5);
            CollectionAssert.AreNotEquivalent(new int[] { 2, 4, 3, 5 }, ints1to5);
            CollectionAssert.AreNotEquivalent(new int[] { 2, 2, 1, 1, 4, 3, 5 }, ints1to5);
            CollectionAssert.AreNotEquivalent(twothrees, twofours);

            // Helper syntax
            Assert.That(new int[] { 2, 1, 4, 3, 5 }, Is.EquivalentTo(ints1to5));
            Assert.That(new int[] { 2, 2, 4, 3, 5 }, Is.Not.EquivalentTo(ints1to5));
            Assert.That(new int[] { 2, 4, 3, 5 }, Is.Not.EquivalentTo(ints1to5));
            Assert.That(new int[] { 2, 2, 1, 1, 4, 3, 5 }, Is.Not.EquivalentTo(ints1to5));

            // Inherited syntax
            Expect(new int[] { 2, 1, 4, 3, 5 }, EquivalentTo(ints1to5));
            Expect(new int[] { 2, 2, 4, 3, 5 }, Not.EquivalentTo(ints1to5));
            Expect(new int[] { 2, 4, 3, 5 }, Not.EquivalentTo(ints1to5));
            Expect(new int[] { 2, 2, 1, 1, 4, 3, 5 }, Not.EquivalentTo(ints1to5));
        }
Exemple #17
0
        // in this we will see if the three starships from the example are the ONLY results possible within the example input (always from the coding challenge document)
        // practically is the same as above but here we see if they are the only results
        public void IsOutputTheSame()
        {
            Int64            input    = 1000000;
            List <ResultDTO> expected = new List <ResultDTO>();

            expected.Add(new ResultDTO()
            {
                StarshipName = "Y-wing", NumberOfStops = 74
            });
            expected.Add(new ResultDTO()
            {
                StarshipName = "Millennium Falcon", NumberOfStops = 9
            });
            expected.Add(new ResultDTO()
            {
                StarshipName = "Rebel transport", NumberOfStops = 11
            });

            Calculate calculate  = new Calculate();
            var       resultList = calculate.CalculateStops(input);
            var       realResult = new List <ResultDTO>();

            foreach (var item in resultList)
            {
                realResult.Add(item);
            }
            CollectionAssert.AreNotEquivalent(expected, realResult);
        }
        public void CollectionAssertsTest()
        {
            CollectionAssert.IsEmpty(new int[] { }, "Collection is empty");
            CollectionAssert.IsNotEmpty(new [] { 1, 2, 3 }, "Collection is not empty");

            var ints = new object[] { 4, 3, 2, 1 };

            CollectionAssert.AllItemsAreNotNull(ints, "All items in array are not null");
            CollectionAssert.AllItemsAreInstancesOfType(ints, typeof(int), "All items in array are int numbers");
            CollectionAssert.AllItemsAreUnique(ints, "All items in array are unique");

            CollectionAssert.Contains(ints, 2, "Int array contains value 2");
            CollectionAssert.DoesNotContain(ints, 0, "Int array does not contain value 0");

            var ints1 = new object[] { 1, 2, 3, 4 };
            var ints2 = new object[] { 2, 3, 4, 5 };
            var ints3 = ints1;

            CollectionAssert.AreEqual(ints1, ints3, "Two references are pointed to the same array");
            CollectionAssert.AreNotEqual(ints1, ints2, "Two references are pointed to the different arrays");

            CollectionAssert.AreEquivalent(ints, ints1, "Two arrays are equivalent");
            CollectionAssert.AreNotEquivalent(ints, ints2, "Two arrays are not equivalent");

            CollectionAssert.IsSubsetOf(new [] { 2, 3 }, ints, "Int array contains set [2, 3]");
            CollectionAssert.IsSubsetOf(new [] { 1, 2, 3, 4 }, ints, "Int array contains set [1, 4]");
            CollectionAssert.IsNotSubsetOf(new [] { 4, 5 }, ints, "Int array does not contain set [4, 5]");
            CollectionAssert.IsNotSubsetOf(new [] { 0, 1, 2, 3, 4, 5 }, ints, "Int array does not contain set [0, 5]");

            CollectionAssert.IsOrdered(ints1, "Array of int numbers is ordered");
        }
Exemple #19
0
        public void StatsByLocationPercentShouldToupleWithDescriptionValuePercentage()
        {
            List <Customer> customers = TestHelpers.GetSampleCustomersList();

            StatsViewModel viewModel = new StatsViewModel(customers);

            viewModel.SelectedStatsType = StatsType.Location;

            List <Tuple <string, decimal, decimal> > expectedList = new List <Tuple <string, decimal, decimal> >()
            {
                new Tuple <string, decimal, decimal>("United States, Alaska", 2, 50),
                new Tuple <string, decimal, decimal>("United States, Florida", 1, 25),
                new Tuple <string, decimal, decimal>("United States, Washington", 1, 25)
            };

            CollectionAssert.AreEquivalent(expectedList, viewModel.StatsDataPercent);

            List <Tuple <string, decimal, decimal> > incorrectList = new List <Tuple <string, decimal, decimal> >()
            {
                new Tuple <string, decimal, decimal>("United States, Alaska", 2, 0),
                new Tuple <string, decimal, decimal>("United States, Florida", 1, 0),
                new Tuple <string, decimal, decimal>("United States, Washington", 1, 0)
            };

            CollectionAssert.AreNotEquivalent(incorrectList, viewModel.StatsData);
        }
        public void IsEndPoint()
        {
            int[]  Parameters   = new int[] { -3, -4, -5 };
            string RangePattern = @"-?[0-9]";

            CollectionAssert.AreNotEquivalent(Parameters, KataRange.EndPoints.Get("(2,8)", RangePattern));
        }
        public void RouletteGameTest()
        {
            var ott = new RouletteGame();

            Assert.AreEqual(38, ott.RouletteNumbers.Length);

            // Test RouletteGame has generated valid bin numbers
            CollectionAssert.AreEquivalent(Enumerable.Range(0, 38).ToArray(),
                                           ott.RouletteNumbers.Select(x => (int)x.Val).ToArray());

            // Test RouletteGame actually generates random bins each time
            {
                var randomBins = new List <RouletteNumber>();

                for (int i = 0; i < 10; i++)
                {
                    randomBins.Add(ott.SpinWheel());
                }

                CollectionAssert.AreNotEquivalent(Enumerable.Range(0, 10).ToArray(),
                                                  randomBins.Select(x => (int)x.Val).ToArray());


                bool isRigged = false;
                foreach (var b in randomBins)
                {
                    isRigged = randomBins.FindAll(x => x == b).Count > 5;
                    if (isRigged)
                    {
                        break;
                    }
                }
                Assert.IsFalse(isRigged);
            }
        }
Exemple #22
0
        public void Items_must_be_different()
        {
            List <string> clients = new List <string> {
                "Aygün2", "Ahmet"
            };

            CollectionAssert.AreNotEquivalent(_clients, clients);
        }
Exemple #23
0
        public void ItemsAndOrderMustNotSame()
        {
            List <string> newUsers = new List <string> {
                "Salih", "Ahmet", "Ali", "Mehmet"
            };

            CollectionAssert.AreNotEquivalent(_users, newUsers);
        }
Exemple #24
0
        public void TwoPageSearchResultsAreDifferent()
        {
            MainPageService.GotoBasePage();
            MainPageService.Search("reddit");
            var searchResultFromFirstPage = SearchResultsPage.GetSearchTitles();

            SearchResultsPage.GoToNextSearchResultPage();
            CollectionAssert.AreNotEquivalent(searchResultFromFirstPage, SearchResultsPage.GetSearchTitles(), "Search results are the same on two pages");
        }
Exemple #25
0
        public void 驗證Collection_集合內容是否不對等()
        {
            // arrange
            var expected = new int[] { 2, 4, 6 };
            var actual   = new int[] { 1, 3, 5 };

            // assert
            CollectionAssert.AreNotEquivalent(expected, actual);
        }
Exemple #26
0
        public void Should_HaveNotAllValuesTheSame_InDifferentLanguages([ValueSource(nameof(SupportedLanguages))] string language)
        {
            var currentLanguageDictionary = GetLocalizationDictionaryAsList(language);

            foreach (var dictionary in SupportedLanguages.Except(new[] { language }).Select(lang => GetLocalizationDictionaryAsList(lang)))
            {
                CollectionAssert.AreNotEquivalent(currentLanguageDictionary, dictionary);
            }
        }
Exemple #27
0
        public void DeepPrototype()
        {
            var vm1 = manager["Test-Win10"];
            var vm2 = manager["Test-Win10"];

            Assert.AreNotSame(vm1, vm2);
            CollectionAssert.AreNotEquivalent(vm1.Controllers.ToList(), vm2.Controllers.ToList());
            CollectionAssert.AreNotEquivalent(vm1.Controllers.SelectMany(x => x.Disks).ToList(), vm2.Controllers.SelectMany(x => x.Disks).ToList());
        }
Exemple #28
0
        public void ImmediateTypeGetProperties()
        {
            var immediateType1 = new ImmediateType(typeof(PublicValueTypeTestClass));

            CollectionAssert.AreEquivalent(immediateType1.Properties, immediateType1.GetProperties());

            var immediateType2 = new ImmediateType(typeof(PublicReferenceTypeTestClass));

            CollectionAssert.AreNotEquivalent(immediateType1.GetProperties(), immediateType2.GetProperties());
        }
        public void PropertyValidationReplacesOldErrorsWithNewOnes()
        {
            _viewModel.Id = 3;
            var errors = _viewModel.GetErrors(nameof(_viewModel.Id)).Cast <string>().ToArray();

            _viewModel.Id = -1;
            var updatedErrors = _viewModel.GetErrors(nameof(_viewModel.Id)).Cast <string>().ToArray();

            CollectionAssert.AreNotEquivalent(errors, updatedErrors);
        }
        public void DeveRetornarCartasEmbaralhadas()
        {
            const int numeroDeCartasParaOJogo = 13;
            var       cartasOrdenadas         = TodasAsCartas.Todas.Take(numeroDeCartasParaOJogo).ToList();

            var cartasEmbaralhadas = TodasAsCartas.Embaralhar(numeroDeCartasParaOJogo);

            Assert.AreEqual(numeroDeCartasParaOJogo, cartasEmbaralhadas.Count);
            CollectionAssert.AreNotEquivalent(cartasOrdenadas, cartasEmbaralhadas);
        }