public async Task GetCustomerDetail()
        {
            var sut = new GetCustomerDetailQueryHandler(_context, _mapper);

            var result = await sut.Handle(new GetCustomerDetailQuery { Id = 1 }, CancellationToken.None);

            result.ShouldBeOfType <CustomerDetailVm>();
            result.Id.ShouldBe(1);
        }
예제 #2
0
        public async Task GetCustomerDetail()
        {
            var sut = new GetCustomerDetailQueryHandler(_context);

            var result = await sut.Handle(new GetCustomerDetailQuery { Id = "JASON" }, CancellationToken.None);

            result.ShouldBeOfType <CustomerDetailModel>();
            result.Id.ShouldBe("JASON");
        }
예제 #3
0
        public async Task ItShouldGetCustomerDetail()
        {
            var customer = new Customer
            {
                CustomerId   = 1,
                CustomerName = "first last"
            };

            var context = new Mock <ICustomerRepository>();

            context.Setup(_ => _.GetCustomerById(It.IsAny <int>())).ReturnsAsync(customer);

            var sut    = new GetCustomerDetailQueryHandler(context.Object);
            var result = await sut.Handle(new GetCustomerDetailQuery { Id = 1 }, CancellationToken.None);

            result.ShouldBeOfType <Customer>();
            result.ShouldBe(customer);
        }