public Task <GetUserByEmailResult> ExecuteAsync(GetUserByEmailParameters parameters, CancellationToken cancellationToken = default)
        {
            if (parameters is null)
            {
                throw new System.ArgumentNullException(nameof(parameters));
            }

            return(InvokeExecuteAsync(parameters, cancellationToken));
        }
Ejemplo n.º 2
0
        public Task <ActionResult> GetUserByEmailAsync(GetUserByEmailParameters parameters, [FromServices] IGetUserByEmailHandler handler, CancellationToken cancellationToken)
        {
            if (handler is null)
            {
                throw new ArgumentNullException(nameof(handler));
            }

            return(InvokeGetUserByEmailAsync(parameters, handler, cancellationToken));
        }
Ejemplo n.º 3
0
        private async Task <GetUserByEmailResult> InvokeExecuteAsync(GetUserByEmailParameters parameters, CancellationToken cancellationToken)
        {
            var data = new User
            {
                Id        = Guid.NewGuid(),
                FirstName = "John",
                LastName  = "Doe",
                Email     = parameters.Email
            };

            return(await Task.FromResult(data));
        }
Ejemplo n.º 4
0
        public Task <GetUserByEmailResult> ExecuteAsync(GetUserByEmailParameters parameters, CancellationToken cancellationToken = default)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }

            if (parameters.Email == "*****@*****.**")
            {
                return(Task.FromResult(GetUserByEmailResult.NotFound($"Could not find user with email={parameters.Email}")));
            }

            return(InvokeExecuteAsync(parameters, cancellationToken));
        }
Ejemplo n.º 5
0
        public Task <GetUserByEmailResult> ExecuteAsync(GetUserByEmailParameters parameters, CancellationToken cancellationToken = default)
        {
            var data = new User
            {
                Id             = Guid.Parse("77a33260-0000-441f-ba60-b0a833803fab"),
                Gender         = GenderType.Female,
                FirstName      = "Hallo",
                LastName       = "Hallo1",
                Email          = "*****@*****.**",
                Color          = ColorType.Red,
                HomeAddress    = new Address(),
                CompanyAddress = new Address(),
            };

            return(Task.FromResult(GetUserByEmailResult.Ok(data)));
        }
Ejemplo n.º 6
0
        public Task <GetUserByEmailResult> ExecuteAsync(GetUserByEmailParameters parameters, CancellationToken cancellationToken = default)
        {
            var data = new User
            {
                Id          = Guid.Parse("77a33260-0000-441f-ba60-b0a833803fab"),
                Gender      = GenderType.Female,
                FirstName   = "Hallo1",
                LastName    = "Hallo2",
                Email       = "*****@*****.**",
                Homepage    = new Uri("http://www.dr.dk"),
                Color       = ColorType.Red,
                HomeAddress = new Address
                {
                    StreetName   = "Hallo",
                    StreetNumber = "Hallo1",
                    PostalCode   = "Hallo2",
                    CityName     = "Hallo3",
                    MyCountry    = new Country
                    {
                        Name       = "Hallo1",
                        Alpha2Code = "Ha",
                        Alpha3Code = "Hal",
                    },
                },
                CompanyAddress = new Address
                {
                    StreetName   = "Hallo",
                    StreetNumber = "Hallo1",
                    PostalCode   = "Hallo2",
                    CityName     = "Hallo3",
                    MyCountry    = new Country
                    {
                        Name       = "Hallo1",
                        Alpha2Code = "Ha",
                        Alpha3Code = "Hal",
                    },
                },
            };

            return(Task.FromResult(GetUserByEmailResult.Ok(data)));
        }
Ejemplo n.º 7
0
 private static async Task <ActionResult> InvokeGetUserByEmailAsync(GetUserByEmailParameters parameters, IGetUserByEmailHandler handler, CancellationToken cancellationToken)
 {
     return(await handler.ExecuteAsync(parameters, cancellationToken));
 }
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
        private async Task <GetUserByEmailResult> InvokeExecuteAsync(GetUserByEmailParameters parameters, CancellationToken cancellationToken)
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
        {
            throw new System.NotImplementedException();
        }