コード例 #1
0
ファイル: has_not_been_defined.cs プロジェクト: lukesmith/lix
        public void should_find_the_original_specification()
        {
            var specification = new FindAll<Fish>();

            var interceptBy = Specification.Interceptors.GetReplacement(specification);
            interceptBy.ShouldBeTheSameObjectAs(specification);
        }
コード例 #2
0
        private void DelegateMethod()
        {
            ConsoleUtility.PrintInfo(".Net 1 technique for finding items using a delegate find method, for better seperation of concerns.");

            var foundItems = new FindAll(FindProductsPriceGreater10).Invoke(new ArrayList(Product.GetSampleProducts()));
            foreach (Product product in foundItems)
            {
                ConsoleUtility.PrintSuccess(product.ToString());
            }
        }
コード例 #3
0
ファイル: FindAllHandler.cs プロジェクト: skohub/BonusCards
        public IEnumerable <CardDto> Query(FindAll query)
        {
            var dtos = _context.Cards
                       .Include(c => c.Purchases)
                       .Include(c => c.Withdraws)
                       .Select(c => new CardDto {
                Id = c.Id, Bonuses = c.GetAvailableBonuses()
            });

            return(dtos);
        }
コード例 #4
0
        private void DelegateMethod()
        {
            ConsoleUtility.PrintInfo(".Net 1 technique for finding items using a delegate find method, for better seperation of concerns.");

            var foundItems = new FindAll(FindProductsPriceGreater10).Invoke(new ArrayList(Product.GetSampleProducts()));

            foreach (Product product in foundItems)
            {
                ConsoleUtility.PrintSuccess(product.ToString());
            }
        }
コード例 #5
0
        public void CreateShouldSaveImage()
        {
            // Arrange
            var str    = "input";
            var buffer = System.Text.Encoding.UTF8.GetBytes(str);
            var stream = new MemoryStream(buffer);
            var imgUrl = "~/Content/Images/Site/TestFile.jpeg";

            _imageUpload.ContentLength.Returns(1024);
            _imageUpload.ContentType.Returns("image/jpeg");
            _imageUpload.FileName.Returns("TestFile.jpeg");
            _imageUpload.InputStream.Returns(stream);
            _imageViewModel.ImageUpload = _imageUpload;
            _imageViewModel.Image       = new Image();

            // Act
            _controller.Create(_imageViewModel);

            // Assert
            var query  = new FindAll <Image>();
            var slider = query.Execute(_context).First();

            Assert.IsTrue(slider.ImageUrl == imgUrl);
        }
コード例 #6
0
 public IEnumerable <TRoot> Handle(FindAll <TRoot> query)
 {
     return(_repository.GetAll());
 }
コード例 #7
0
 protected virtual void OnFindAll(FindEventArgs e)
 {
     FindAll?.Invoke(this, e);
 }
コード例 #8
0
ファイル: CardsController.cs プロジェクト: skohub/BonusCards
        public IActionResult Get()
        {
            var query = new FindAll();

            return(Ok(_bus.Query <FindAll, IEnumerable <CardDto> >(query)));
        }