private bool AssertNotFoundInterfaceInfosEqual(InterfaceDeficitInfo actualDeficitInfo,
                                                InterfaceDeficitInfo expectedDeficitInfo)
 {
     return(actualDeficitInfo.ProblemInterface.SameIdentityAs(expectedDeficitInfo.ProblemInterface) &&
            actualDeficitInfo.Deficit == expectedDeficitInfo.Deficit &&
            UtilsAssert.CollectionsEqual(expectedDeficitInfo.RequiredByComponents,
                                         actualDeficitInfo.RequiredByComponents));
 }
        public void GetComponentInterface_ComponentExists_ShouldThrowNotFoundException()
        {
            //Arrange
            RepositoryMock.Setup(x => x.Query(It.IsAny <PersistenceAwareSpecification <ComponentInterface> >()))
            .Returns(new List <ComponentInterface>().AsAsyncQueryable());

            //Assert
            UtilsAssert.AssertThrowsAggregateException <NotFoundException, ComponentInterfaceVO>(
                () => Service.GetComponentInterface(Guid.NewGuid()).Result);
        }
        public void GetComponentInterfaces_SortByNotExistingColumn_ShouldThrowInvalidInputException()
        {
            //Arrange
            FillRepositoryWithFakes(ListSize);
            var requestParameters = new TableParameters(new PagingParameters(0, 5),
                                                        new OrderingParameters(Guid.NewGuid().ToString(), SortDirection.Ascending));

            //Assert
            UtilsAssert.AssertThrowsAggregateException <InvalidInputException>(
                () => Service.GetComponentInterfaces(requestParameters).Wait());
        }
Exemplo n.º 4
0
 private void AssertComponentsEqual(PCComponent savedComp, PCComponent loadedComp)
 {
     Assert.That(loadedComp, Is.Not.Null);
     Assert.That(loadedComp.AveragePrice, Is.EqualTo(savedComp.AveragePrice));
     Assert.That(loadedComp.Name, Is.EqualTo(savedComp.Name));
     Assert.That(UtilsAssert.CollectionsEqual(savedComp.ContainedSlots, loadedComp.ContainedSlots));
     Assert.That(UtilsAssert.CollectionsEqual(savedComp.PlugSlots, loadedComp.PlugSlots));
     Assert.That(UtilsAssert.CollectionsEqual(savedComp.ContainedComponents, loadedComp.ContainedComponents));
     Assert.That(UtilsAssert.CollectionsEqual(savedComp.CharacteristicValues, loadedComp.CharacteristicValues,
                                              CompareCharacteristicValues));
 }
        private static void AssertResultsEqual(PagedResult <ComponentInterface> expectedResult,
                                               PagedResult <ComponentInterfaceVO> actualResult)
        {
            Assert.That(expectedResult.CountTotal == actualResult.CountTotal);
            Assert.That(expectedResult.PagingParameters.PageNumber == actualResult.PagingParameters.PageNumber);
            Assert.That(expectedResult.PagingParameters.PageSize == actualResult.PagingParameters.PageSize);

            Assert.That(UtilsAssert.CollectionsEqual(
                            new ReadOnlyCollection <ComponentInterface>(expectedResult.Items),
                            new ReadOnlyCollection <ComponentInterfaceVO>(actualResult.Items),
                            (a, b) => a.Name == b.Name));
        }
 private void AssertNotFoundInterfaceInfosEqual(List <InterfaceDeficitInfo> actualList,
                                                List <InterfaceDeficitInfo> expectedList)
 {
     Assert.That(UtilsAssert.CollectionsEqual(expectedList, actualList, AssertNotFoundInterfaceInfosEqual));
 }