public void Sets_Zero_Values_If_Parameter_Not_Tracked()
        {
            var tuple  = TimesBuilders.ReturnMockLists();
            var labels = tuple.Item1;
            var values = tuple.Item2;

            Times outputTimes   = FspTimesParser.ParseTimes(labels, values);
            Times expectedTimes = Builders.TimesBuilders.ReturnTimesAllZeroButAircraftId();

            // Using CompareNetObjects to compare the two objects
            var compareLogic = new CompareLogic();

            Assert.True(compareLogic.Compare(expectedTimes, outputTimes).AreEqual);
        }
Exemplo n.º 2
0
        public async Task GetAll_test()
        {
            //Given(Preparação)
            using var dbconnection = await new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider).OpenAsync();

            dbconnection.CreateTableIfNotExists <Drone>();
            var expectresult = new AutoFaker <Drone>()
                               .RuleFor(fake => fake.Status, fake => DroneStatus.Pronto.ToString())
                               .Generate(4);

            await dbconnection.InsertAllAsync(expectresult);

            var baseRepositoryMock = new DronesRepository(dbconnection);

            //When

            var result = await baseRepositoryMock.GetAll();

            //Then
            var comparacao = _comparison.Compare(result.ConvertTo <List <Drone> >(), expectresult);

            Assert.True(comparacao.AreEqual);
        }
Exemplo n.º 3
0
        public static void ShouldCompareTo <T1, T2>(this T1 actual, T2 expected, CompareLogic compareLogic = null)
        {
            compareLogic = compareLogic ?? new CompareLogic()
            {
                Config = new ComparisonConfig()
                {
                    MaxDifferences = 100
                }
            };

            var result = compareLogic.Compare(actual, expected);

            Assert.True(result.AreEqual, result.DifferencesString);
        }
        public void ThenFundingPeriodsAreMappedCorrectly()
        {
            //Act
            var result = _mapper.MapFrom(new List <Standard> {
                TestHelper.Clone(_standard)
            });

            var comparer = new CompareLogic(new ComparisonConfig
            {
                IgnoreObjectTypes = true
            });

            Assert.IsTrue(comparer.Compare(result.Standards[0].FundingPeriods, _standard.FundingPeriods).AreEqual);
        }
        public void VerifyGenericTypeArguments(IArrangement arrangement, IInvocation invocation)
        {
            var arrangementMethod = arrangement as IArrangementMethod;
            var arrangementHasNoGenericTypeArguments = arrangementMethod == null;

            if (arrangementHasNoGenericTypeArguments)
            {
                return;
            }

            var arrangementGenericArguments = arrangementMethod.GenericArguments;
            var invocationGenericArguments  = invocation.GenericArguments ?? new Type[0];
            var comparisonResult            = _compareLogic.Compare(arrangementGenericArguments, invocationGenericArguments);

            if (comparisonResult.AreEqual)
            {
                return;
            }

            var mockExceptionMessage = _mockFailureMessageFactory.GetGenericTypeArgumentFailureMessage(arrangement, invocation);

            throw new MockException(mockExceptionMessage);
        }
Exemplo n.º 6
0
        public void CompareGiantLists()
        {
            int           max      = 10000;
            List <Person> persons1 = new List <Person>();

            for (int i = 0; i < max; i++)
            {
                Person person = new Person();
                person.Name = "Greg";
                persons1.Add(person);
            }

            List <Person> persons2 = Common.CloneWithSerialization(persons1);

            Stopwatch watch = new Stopwatch();

            watch.Start();
            ComparisonResult result = _compare.Compare(persons1, persons2);

            watch.Stop();

            Console.WriteLine(watch.ElapsedMilliseconds);
        }
Exemplo n.º 7
0
        public void EnumTypeShownTest()
        {
            Officer officer1 = new Officer();

            officer1.Name = "Greg";
            officer1.Type = Deck.Engineering;

            Officer officer2 = new Officer();

            officer2.Name = "John";
            officer2.Type = Deck.AstroPhysics;

            _compare.Config.MaxDifferences = 2;

            ComparisonResult result = _compare.Compare(officer1, officer2);

            if (!result.AreEqual)
            {
                Console.WriteLine(result.DifferencesString);
            }

            Assert.IsTrue(result.DifferencesString.Contains("Deck"));
        }
Exemplo n.º 8
0
        private void ParseAndAssertObjectGraph(string sourceText, MarkupExtension expected)
        {
            IMarkupExtensionParser markupExtensionParser = new MarkupExtensionParser();
            MarkupExtension        actual;
            var result = markupExtensionParser.TryParse(sourceText, out actual);

            Assert.That(result, Is.True);
            Assert.That(actual, Is.Not.Null);

            var compareLogic  = new CompareLogic();
            var compareResult = compareLogic.Compare(expected, actual);

            Assert.That(compareResult.AreEqual, Is.True, compareResult.DifferencesString);
        }
Exemplo n.º 9
0
        public static bool HasSamePropertyValuesAs <T>(this T first, T second, bool ignoreCollectionOrder, IEnumerable <string> membersToIgnore)
        {
            var compareLogic = new CompareLogic {
                Config = new ComparisonConfig {
                    IgnoreObjectTypes     = true, // allows anonymous types to be compared
                    IgnoreCollectionOrder = ignoreCollectionOrder,
                    MembersToIgnore       = membersToIgnore == null
            ? new List <string>()
            : membersToIgnore.ToList()
                }
            };

            return(compareLogic.Compare(first, second).AreEqual);
        }
Exemplo n.º 10
0
        public void TestThatCitiesAreReadAsExpectedFromFile()
        {
            var fileName    = "citiesTest.txt";
            var fileContent = GetFileContent();

            File.WriteAllText(fileName, fileContent);
            var expectedCities = GetCities();

            fileCitiesProvider = new FileCitiesProvider(fileName);

            var comparer = new CompareLogic();

            Assert.IsTrue(comparer.Compare(expectedCities, fileCitiesProvider.Cities).AreEqual);
        }
        public void SessionStateTelemetryDeepCloneCopiesAllProperties()
        {
            var telemetry = new SessionStateTelemetry();

            telemetry.State     = SessionState.End;
            telemetry.Extension = new MyTestExtension();
            var other = telemetry.DeepClone();

            CompareLogic deepComparator = new CompareLogic();

            var result = deepComparator.Compare(telemetry, other);

            Assert.IsTrue(result.AreEqual, result.DifferencesString);
        }
Exemplo n.º 12
0
        public void GenericEnumerable()
        {
            List <Foo>        fooList       = new List <Foo>();
            IEnumerable <Bar> barEnumerable = fooList.Select(f => new Bar());
            List <Bar>        barList       = new List <Bar>();

            CompareLogic logic = new CompareLogic();

            logic.Config.IgnoreObjectTypes = true;

            ComparisonResult result = logic.Compare(barEnumerable, barList);

            Assert.IsTrue(result.AreEqual, result.DifferencesString);
        }
Exemplo n.º 13
0
        public void EncodeFileSetsTokensFromPreviousRunAsExpected()
        {
            using (var fileReader = new FileReader(filePathFile, new Buffer()))
            {
                using (var fileWriter = new FileWriter(filePathEncodedFile, new Buffer()))
                {
                    lz77Encoder.EncodeFile(fileReader, fileWriter, Constants.BitsForOffset1, Constants.BitsForLength1);
                }
            }

            var comparer = new CompareLogic();

            Assert.IsTrue(comparer.Compare(Constants.GetTokens1(), lz77Encoder.TokensFromPreviousRun).AreEqual);
        }
Exemplo n.º 14
0
        public void ParseUserInfo_NamePlusEmailString_UserInfo()
        {
            var value    = "\"testname\" <testEmail>";
            var expected = new UserInfo
            {
                Email = "testEmail",
                Name  = "\"testname\""
            };
            var actual       = Helper.ParseUserInfo(value);
            var compaitLogic = new CompareLogic();
            var result       = compaitLogic.Compare(expected, actual);

            Assert.IsTrue(result.AreEqual, result.DifferencesString);
        }
Exemplo n.º 15
0
        public void RefStructProperty()
        {
            var compareLogic = new CompareLogic(new ComparisonConfig
            {
                MembersToIgnore =
                {
                    "Item"
                }
            });

            var differences = compareLogic.Compare(new RefStructClass(), new RefStructClass());

            Assert.IsTrue(differences.AreEqual);
        }
        public void CompareLogicShouldHandleExpandoObjects()
        {
            dynamic x = new ExpandoObject();

            x.A = 1;
            dynamic y = new ExpandoObject();

            x.B = 2;

            var compareLogic = new CompareLogic();
            var result       = compareLogic.Compare(x as ExpandoObject, y as ExpandoObject);

            Assert.False(result.AreEqual);
        }
Exemplo n.º 17
0
        public void GetByLoginTest()
        {
            var user = new UserData {
                Login = "******", Id = "123"
            };

            var currentUserProgresses = new[]
            {
                new CourseProgressData {
                    Id = $"{user.Login}{123}", LessonProgresses = new List <LessonProgressData>()
                },
                new CourseProgressData {
                    Id = $"{user.Login}{124}", LessonProgresses = new List <LessonProgressData>()
                },
                new CourseProgressData {
                    Id = $"{user.Login}{125}", LessonProgresses = new List <LessonProgressData>()
                },
            };

            var otherProgresses = new[]
            {
                new CourseProgressData {
                    Id = "someid1", LessonProgresses = new List <LessonProgressData>()
                },
                new CourseProgressData {
                    Id = "someid2", LessonProgresses = new List <LessonProgressData>()
                },
                new CourseProgressData {
                    Id = "someid3", LessonProgresses = new List <LessonProgressData>()
                }
            };

            progressRepositoryDbContext.Collection.InsertMany(currentUserProgresses);
            progressRepositoryDbContext.Collection.InsertMany(otherProgresses);

            var result = progressRepository.GetAllByUserAsync(user.Id).Result.ToList();

            var compareLogic = new CompareLogic
            {
                Config =
                {
                    IgnoreCollectionOrder = true,
                    IgnoreObjectTypes     = true
                }
            };

            var compareResult = compareLogic.Compare(currentUserProgresses, result);

            Assert.IsTrue(compareResult.AreEqual);
        }
Exemplo n.º 18
0
        // '"fromWallet()" returns a well-formed "CommercioDocReceipt" object.'
        public void WellFormedCommercioDocReceiptFromWallet()
        {
            //This is the comparison class
            CompareLogic compareLogic = new CompareLogic();

            NetworkInfo   networkInfo    = new NetworkInfo(bech32Hrp: "did:com:", lcdUrl: "");
            String        mnemonicString = "dash ordinary anxiety zone slot rail flavor tortoise guilt divert pet sound ostrich increase resist short ship lift town ice split payment round apology";
            List <String> mnemonic       = new List <String>(mnemonicString.Split(" ", StringSplitOptions.RemoveEmptyEntries));
            Wallet        wallet         = Wallet.derive(mnemonic, networkInfo);


            String uuid         = Guid.NewGuid().ToString();
            String recipientDid = "did:com:id";
            String txHash       = "txHash";
            String documentId   = "documentId";

            CommercioDocReceipt expectedDocReceipt = new CommercioDocReceipt(
                uuid: uuid,
                senderDid: wallet.bech32Address,
                recipientDid: recipientDid,
                txHash: txHash,
                documentUuid: documentId
                );

            CommercioDocReceipt commercioDocReceipt = CommercioDocReceiptHelper.fromWallet(
                wallet: wallet,
                recipient: recipientDid,
                txHash: txHash,
                documentId: documentId
                );

            Assert.AreEqual(compareLogic.Compare(commercioDocReceipt.uuid, expectedDocReceipt.uuid).AreEqual, false);
            Assert.AreEqual(compareLogic.Compare(commercioDocReceipt.senderDid, expectedDocReceipt.senderDid).AreEqual, true);
            Assert.AreEqual(compareLogic.Compare(commercioDocReceipt.recipientDid, expectedDocReceipt.recipientDid).AreEqual, true);
            Assert.AreEqual(compareLogic.Compare(commercioDocReceipt.txHash, expectedDocReceipt.txHash).AreEqual, true);
            Assert.AreEqual(compareLogic.Compare(commercioDocReceipt.documentUuid, expectedDocReceipt.documentUuid).AreEqual, true);
        }
Exemplo n.º 19
0
        // '"fromWallet()" returns a well-formed "CommercioDocReceipt" object.'
        public void WellFormedCommercioDocReceiptFromWallet()
        {
            //This is the comparison class
            CompareLogic compareLogic = new CompareLogic();

            NetworkInfo   networkInfo    = new NetworkInfo(bech32Hrp: "did:com:", lcdUrl: "");
            String        mnemonicString = "gorilla soldier device force cupboard transfer lake series cement another bachelor fatigue royal lens juice game sentence right invite trade perfect town heavy what";
            List <String> mnemonic       = new List <String>(mnemonicString.Split(" ", StringSplitOptions.RemoveEmptyEntries));
            Wallet        wallet         = Wallet.derive(mnemonic, networkInfo);


            String uuid         = Guid.NewGuid().ToString();
            String recipientDid = "did:com:id";
            String txHash       = "txHash";
            String documentId   = "documentId";

            CommercioDocReceipt expectedDocReceipt = new CommercioDocReceipt(
                uuid: uuid,
                senderDid: wallet.bech32Address,
                recipientDid: recipientDid,
                txHash: txHash,
                documentUuid: documentId
                );

            CommercioDocReceipt commercioDocReceipt = CommercioDocReceiptHelper.fromWallet(
                wallet: wallet,
                recipient: recipientDid,
                txHash: txHash,
                documentId: documentId
                );

            Assert.AreEqual(compareLogic.Compare(commercioDocReceipt.uuid, expectedDocReceipt.uuid).AreEqual, false);
            Assert.AreEqual(compareLogic.Compare(commercioDocReceipt.senderDid, expectedDocReceipt.senderDid).AreEqual, true);
            Assert.AreEqual(compareLogic.Compare(commercioDocReceipt.recipientDid, expectedDocReceipt.recipientDid).AreEqual, true);
            Assert.AreEqual(compareLogic.Compare(commercioDocReceipt.txHash, expectedDocReceipt.txHash).AreEqual, true);
            Assert.AreEqual(compareLogic.Compare(commercioDocReceipt.documentUuid, expectedDocReceipt.documentUuid).AreEqual, true);
        }
Exemplo n.º 20
0
        public void GroupCoordinatorResponse()
        {
            var response1 = new GroupCoordinatorResponse {
                //CorrelationId = _random.Next(),
                CoordinatorHost = Guid.NewGuid().ToString(),
                CoordinatorPort = _random.Next(),
            };

            Stream binary1 = new MemoryStream();

            response1.Serialize(binary1);

            binary1.Seek(0L, SeekOrigin.Begin);
            var response2 = new GroupCoordinatorResponse();

            response2.Deserialize(binary1);

            var compareLogic = new CompareLogic();
            var result       = compareLogic.Compare(response1, response2);

            Assert.True(result.AreEqual);

            Stream binary2 = new MemoryStream();

            response2.Serialize(binary2);
            Assert.Equal(binary1.Length, binary2.Length);

            using (var stream1 = new MemoryStream())
                using (var stream2 = new MemoryStream()) {
                    binary1.Seek(0L, SeekOrigin.Begin);
                    binary1.CopyTo(stream1);

                    binary2.Seek(0L, SeekOrigin.Begin);
                    binary2.CopyTo(stream2);

                    Assert.Equal(stream1.Length, stream2.Length);
                    stream1.Seek(0L, SeekOrigin.Begin);
                    var bytes1 = stream1.ToArray();

                    stream2.Seek(0L, SeekOrigin.Begin);
                    var bytes2 = stream2.ToArray();
                    Assert.Equal(bytes1.Length, bytes2.Length);

                    for (int i = 0; i < bytes1.Length; i++)
                    {
                        Assert.Equal(bytes1[i], bytes2[i]);
                    }
                }
        }
Exemplo n.º 21
0
        protected void WhenWeHandle(TCommand command)
        {
            var aggregateId = ExtractAggregateId(command);

            _eventPublisher = new SpecEventPublisher();
            _eventStore     = new SpecEventStore(_eventPublisher, HistoricalEvents);
            var repository = new Repository(_eventStore);

            Session           = new Session(repository);
            OriginalAggregate = GetCopyOfAggregate(aggregateId);

            _handler = BuildHandler();

            try
            {
                TimeBeforeHandling = DateTimeOffset.UtcNow;

                if (_handler is ICancellableCommandHandler <TCommand> )
                {
                    ((ICancellableCommandHandler <TCommand>)_handler).Handle(command).GetAwaiter().GetResult();
                }
                else if (_handler is ICommandHandler <TCommand> )
                {
                    ((ICommandHandler <TCommand>)_handler).Handle(command).GetAwaiter().GetResult();
                }
                else
                {
                    throw new InvalidCastException(
                              $"{nameof(_handler)} is not a command handler of type {typeof(TCommand)}");
                }

                TimeAfterHandling = DateTimeOffset.UtcNow;
            }
            catch (Exception ex)
            {
                ThrownException = ex;
            }
            finally
            {
                NewAggregate = GetAggregate(aggregateId).Result;

                _compareLogic.Config.IgnoreCollectionOrder = IgnoreCollectionOrderDuringComparison;
                _compareLogic.Config.MembersToIgnore.Add("CalculatedVersion");
                ComparisonResult = _compareLogic.Compare(OriginalAggregate, NewAggregate);

                PublishedEvents  = _eventPublisher.PublishedEvents;
                EventDescriptors = _eventStore.Events;
            }
        }
Exemplo n.º 22
0
        public void HeartbeatRequest()
        {
            var request = new HeartbeatRequest();

            request.GroupId      = Guid.NewGuid().ToString();
            request.GenerationId = _random.Next();
            request.MemberId     = Guid.NewGuid().ToString();

            Stream binary1 = new MemoryStream();

            request.Serialize(binary1);

            binary1.Seek(0L, SeekOrigin.Begin);
            var request2 = new HeartbeatRequest();

            request2.Deserialize(binary1);

            var compareLogic = new CompareLogic();
            var result       = compareLogic.Compare(request, request2);

            Assert.True(result.AreEqual);

            Stream binary2 = new MemoryStream();

            request.Serialize(binary2);
            Assert.Equal(binary1.Length, binary2.Length);

            using (var stream1 = new MemoryStream())
                using (var stream2 = new MemoryStream()) {
                    binary1.Seek(0L, SeekOrigin.Begin);
                    binary1.CopyTo(stream1);

                    binary2.Seek(0L, SeekOrigin.Begin);
                    binary2.CopyTo(stream2);

                    Assert.Equal(stream1.Length, stream2.Length);
                    stream1.Seek(0L, SeekOrigin.Begin);
                    var bytes1 = stream1.ToArray();

                    stream2.Seek(0L, SeekOrigin.Begin);
                    var bytes2 = stream2.ToArray();
                    Assert.Equal(bytes1.Length, bytes2.Length);

                    for (int i = 0; i < bytes1.Length; i++)
                    {
                        Assert.Equal(bytes1[i], bytes2[i]);
                    }
                }
        }
        public async Task <ReAnalysisResults> ReAnalyzeExistingAsync()
        {
            var pageSize           = 100;
            var currentPage        = 0;
            var recordsLastFetched = 0;
            var reAnalysisResults  = new ReAnalysisResults();

            do
            {
                var currentRepositoryBatch = await repositoryManager.ReadMultipleAsync(null, currentPage, pageSize);

                if (currentRepositoryBatch.Count > 0)
                {
                    foreach (var repository in currentRepositoryBatch)
                    {
                        var existingTypeAndImplementations = repository.Snapshot.TypesAndImplementations;

                        var reCalculatedTypeAndImplementations = await ScrapeRepositoryTypeAndImplementation(
                            repository.CurrentState.Name,
                            repository.Snapshot.Files,
                            repository.Snapshot.Dependencies,
                            repository.CurrentState.Topics?.Select(topic => topic.Name),
                            new BacklogInfo { HasIssues = repository.CurrentState.HasIssues ?? false },
                            null).ConfigureAwait(false);

                        var compareLogic     = new CompareLogic();
                        var comparisonResult = compareLogic.Compare(existingTypeAndImplementations, reCalculatedTypeAndImplementations);

                        if (!comparisonResult.AreEqual)
                        {
                            repository.Snapshot.TypesAndImplementations = reCalculatedTypeAndImplementations;

                            // TODO: Have this go through the manager and bypass existing logic ... there aren't any snapshot window
                            // updates needed here
                            await repositorySnapshotRepository.UpsertAsync(repository.Snapshot).ConfigureAwait(false);

                            reAnalysisResults.RecordsUpdated++;
                        }

                        reAnalysisResults.RecordsAnalyized++;
                    }
                }

                recordsLastFetched = currentRepositoryBatch.Count;
                currentPage++;
            } while (recordsLastFetched == pageSize);

            return(reAnalysisResults);
        }
Exemplo n.º 24
0
        public void GetCustomerByCustomerGuids_ValidCustomers_ReturnsData()
        {
            //Arrange
            var customerUid1 = Guid.NewGuid();
            var customerUid2 = Guid.NewGuid();
            var customeUids  = new Guid[] { customerUid1, customerUid2 };
            var customers    = new List <DbCustomer>
            {
                new DbCustomer
                {
                    CustomerID        = 1,
                    CustomerUID       = customerUid1,
                    fk_CustomerTypeID = 1,
                    CustomerName      = "CUS01",
                    LastCustomerUTC   = DateTime.UtcNow.AddDays(-1)
                },
                new DbCustomer
                {
                    CustomerID        = 2,
                    CustomerUID       = customerUid2,
                    fk_CustomerTypeID = 1,
                    CustomerName      = "CUS02",
                    LastCustomerUTC   = DateTime.UtcNow.AddDays(-2)
                }
            };

            var config = new ComparisonConfig
            {
                IgnoreObjectTypes             = true,
                MaxMillisecondsDateDifference = 500,
                MaxDifferences = 0
            };
            var accountCompareLogic = new CompareLogic(config);

            transaction.Get <DbCustomer>(Arg.Any <string>()).Returns(customers);

            //Act
            var resultData = customerService.GetCustomerByCustomerGuids(customeUids);

            //Assert
            Assert.NotNull(resultData);
            Assert.Equal(2, resultData.Count);
            transaction.Received(1).Get <DbCustomer>(Arg.Is <string>(q =>
                                                                     q.Contains($"UNHEX('{customerUid1.ToString("N")}')," +
                                                                                $"UNHEX('{customerUid2.ToString("N")}')")));
            ComparisonResult compareResult = accountCompareLogic.Compare(customers, resultData);

            Assert.True(compareResult.Differences.Count == 0);
        }
Exemplo n.º 25
0
        internal OperationResult WasModifiedOperationDelegate(Clause clause, object?state1, object?state2, IEnumerable <ClauseCapture>?captures)
        {
            var compareLogic = new CompareLogic();

            // Gather all differences if we are capturing
            compareLogic.Config.MaxDifferences = clause.Capture ? int.MaxValue : 1;

            var comparisonResult = compareLogic.Compare(state1, state2);

            if ((!comparisonResult.AreEqual && !clause.Invert) || (comparisonResult.AreEqual && clause.Invert))
            {
                return(new OperationResult(true, !clause.Capture ? null : new TypedClauseCapture <ComparisonResult>(clause, comparisonResult, state1, state2)));
            }
            return(new OperationResult(false, null));
        }
Exemplo n.º 26
0
        public async Task GetCourse_ValidCourse_ReturnsEqualCourseData()
        {
            var extractor = new Extractor("https://www.linkedin.com/learning/learning-to-be-assertive?autoplay=true&u=104942210", Quality.Low, VALID_TOKEN);
            var progress  = new Progress <float>(progressPercent => ConsoleOutput.Instance.WriteLine((progressPercent * 100).ToString(), OutputLevel.Information));
            var course    = await extractor.GetCourse(progress);

            CompareLogic compareLogic = new CompareLogic();

            compareLogic.Config.IgnoreProperty <Video>(x => x.DownloadUrl);
            compareLogic.Config.IgnoreProperty <Video>(x => x.TranscriptLines);
            compareLogic.Config.IgnoreProperty <ExerciseFile>(x => x.DownloadUrl);
            ComparisonResult comparisonResult = compareLogic.Compare(CourseObjects.VALIDCOURSE, course);

            Assert.AreEqual(CourseObjects.VALIDCOURSE, course, comparisonResult.DifferencesString);
        }
Exemplo n.º 27
0
        public static void CompareToDynamicList(this Table table, List <Dictionary <string, dynamic> > dynamicList, Type type)
        {
            var expected = table.ConvertToDynamicDictionaryList(type);

            CompareLogic compareLogic = new CompareLogic();

            compareLogic.Config.MembersToInclude.AddRange(table.Header.ToList());
            compareLogic.Config.MembersToIgnore.AddRange(new List <string> {
                "Count"
            });
            compareLogic.Config.IgnoreCollectionOrder = true;
            ComparisonResult result = compareLogic.Compare(expected, dynamicList);

            result.Should().Be(true, result.DifferencesString);
        }
Exemplo n.º 28
0
        public void GetByLoginTest()
        {
            var user = new UserData {
                Login = "******", Id = "123"
            };

            userRepositoryDbContext.Collection.InsertOne(user);

            var result = userRepository.GetByLoginAsync(user.Login).Result;

            var compareLogic  = new CompareLogic();
            var compareResult = compareLogic.Compare(user, result);

            Assert.IsTrue(compareResult.AreEqual);
        }
Exemplo n.º 29
0
        public void ParameterizeInClauseQuery_InClause_ExpectedParametersReturned()
        {
            var props    = QueryHelper.ParameterizeInClauseQuery(IN_CLAUSE_QUERY, _inClauseInput);
            var expected = new List <IDbDataParameter>
            {
                new SqlParameter(IN_CLAUSE_OUT_PRM_NAME_1, _inClauseInput[0]),
                new SqlParameter(IN_CLAUSE_OUT_PRM_NAME_2, _inClauseInput[1]),
                new SqlParameter(IN_CLAUSE_OUT_PRM_NAME_3, DBNull.Value)
            };

            var compareLogic = new CompareLogic();
            var result       = compareLogic.Compare(props.Parameters, expected);

            result.AreEqual.Should().BeTrue();
        }
Exemplo n.º 30
0
        public void AutoMapper_Convert_IsValid(StockRawData.Row row, Stock expected)
        {
            // Arrange
            var config = new MapperConfiguration(cfg => cfg.AddProfile(new StockMapProfile()));
            var mapper = config.CreateMapper();

            // Act
            var result = mapper.Map <StockRawData.Row, Stock>(row);

            // Assert
            CompareLogic compareLogic = new CompareLogic();
            var          comparision  = compareLogic.Compare(expected, result);

            Assert.True(comparision.AreEqual);
        }