Пример #1
0
 public static IArrangeOrAssert <TSubject, TResult, TVars, TSequence> GivenUsing <TSubject, TResult, TVars, TSequence, TDisposable> (
     this IArrange <TSubject, TResult, TVars, TSequence> arrange,
     Func <ITestContext <TSubject, TResult, TVars, TSequence>, TDisposable> scopeProvider)
     where TDisposable : IDisposable
 {
     return(arrange.GivenUsing(typeof(TDisposable).Name, scopeProvider));
 }
Пример #2
0
 public static IArrangeOrAssert <TSubject, TResult, TVars, TSequence> GivenUsing <TSubject, TResult, TVars, TSequence> (
     this IArrange <TSubject, TResult, TVars, TSequence> arrange,
     string text,
     Action <ITestContext <TSubject, TResult, TVars, TSequence> > setup,
     Action <ITestContext <TSubject, TResult, TVars, TSequence> > cleanup)
 {
     return(arrange.GivenUsing(text, x => new DelegateScope(() => setup(x), () => cleanup(x))));
 }
Пример #3
0
        public static IArrangeOrAssert <TSubject, TResult, TVars, TSequence> Given <TSubject, TResult, TVars, TSequence> (
            this IArrange <TSubject, TResult, TVars, TSequence> arrange,
            string text)
        {
            var controller = arrange.GetTestController();

            controller.AddNotImplementedAction <Arrange>(text);
            return((IArrangeOrAssert <TSubject, TResult, TVars, TSequence>)arrange);
        }
Пример #4
0
        public virtual async Task <IEnumerable <IVehicleMakeDTO> > GetPagedListAsync(IArrange arrange)
        {
            try
            {
                var pagedList = await _repository.GetPagedListAsync(arrange);

                return(pagedList);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Пример #5
0
        public static IArrangeOrAssert <TSubject, TResult, TVars, TSequence> GivenUsing <TSubject, TResult, TVars, TSequence, TDisposable> (
            this IArrange <TSubject, TResult, TVars, TSequence> arrange,
            string text,
            Func <ITestContext <TSubject, TResult, TVars, TSequence>, TDisposable> scopeProvider)
            where TDisposable : IDisposable
        {
            var controller = arrange.GetTestController();

            IDisposable scope = null;

            controller.AddSetupCleanup <Arrange, CleanupCommon>(
                "Create " + text,
                x => scope = scopeProvider((ITestContext <TSubject, TResult, TVars, TSequence>)x),
                "Dispose " + text,
                x => scope.Dispose());
            return((IArrangeOrAssert <TSubject, TResult, TVars, TSequence>)arrange);
        }
Пример #6
0
        public virtual async Task <IEnumerable <IVehicleMakeDTO> > GetPagedListAsync(IArrange arrange)
        {
            try
            {
                int pageNumber = (arrange.Page ?? 1);

                var queryable = _repository.Get <VehicleMake>();

                if (!String.IsNullOrEmpty(arrange.SearchString))
                {
                    queryable = queryable.Where(c => c.Name.Contains(arrange.SearchString));
                }

                switch (arrange.SortOrder)
                {
                case "name_desc":
                    queryable = queryable.OrderByDescending(c => c.Name);
                    break;

                case "Abrv":
                    queryable = queryable.OrderBy(c => c.Abrv);
                    break;

                case "abrv_desc":
                    queryable = queryable.OrderByDescending(c => c.Abrv);
                    break;

                default:
                    queryable = queryable.OrderBy(c => c.Name);
                    break;
                }

                var vehicleMakes = await queryable.ToPagedListAsync(pageNumber, arrange.PageSize);

                var vehicleMakesPaged = vehicleMakes.ToMappedPagedList <VehicleMake, VehicleMakeDTO>();

                return(vehicleMakesPaged);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Пример #7
0
 public static ITestController <TSubject, TResult, TVars, TSequence> GetTestController <TSubject, TResult, TVars, TSequence> (
     this IArrange <TSubject, TResult, TVars, TSequence> arrange)
 {
     return(arrange.Get <ITestController <TSubject, TResult, TVars, TSequence> >());
 }
 public void Setup()
 {
     _stopWatchMock = new Mock <IStopwatch>();
     _pattern       = Pattern.Configure.MeasureExecutionTime(_stopWatchMock.Object).New;
 }
Пример #9
0
 public static IArrangeOrAssert <TSubject, TResult, TVars, TSequence> Given <TSubject, TResult, TVars, TSequence> (
     this IArrange <TSubject, TResult, TVars, TSequence> arrange,
     Arrangement <TSubject, TResult, TVars, TSequence> arrangement)
 {
     return(arrange.Given("<Arrangement>", arrangement));
 }
Пример #10
0
 public VehicleMakeController(IVehicleMakeService vehicleMakeService, IArrange arrange)
 {
     _vehicleMakeService = vehicleMakeService;
     _arrange            = arrange;
 }
Пример #11
0
 public static IArrangeOrAssert <TSubject, TResult, TVars, TSequence> GivenUsing <TSubject, TResult, TVars, TSequence> (
     this IArrange <TSubject, TResult, TVars, TSequence> arrange,
     Type disposableType)
 {
     return(arrange.GivenUsing(disposableType.Name, x => disposableType.CreateInstance <IDisposable>()));
 }