public async Task CreateCustomerDetails(Core.Queries.Models.CustomerDetails model)
        {
            if (model is null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            await _dbContext.CustomersDetails.InsertOneAsync(model);
        }
Ejemplo n.º 2
0
        public async Task GetDetails_should_return_customer_details()
        {
            var customerDetails = new Core.Queries.Models.CustomerDetails(Guid.NewGuid(),
                                                                          "test", "customer", "*****@*****.**", null, Domain.Money.Zero(Domain.Currency.CanadianDollar));

            await _fixture.QueryModelsSeeder.CreateCustomerDetails(customerDetails);

            var endpoint = $"customers/{customerDetails.Id}";
            var response = await _fixture.HttpClient.GetAsync(endpoint);

            response.Should().NotBeNull();
            response.IsSuccessStatusCode.Should().BeTrue();
            response.StatusCode.Should().Be(HttpStatusCode.OK);

            var result = await response.Content.ReadAsAsync <Core.Queries.Models.CustomerDetails>();

            result.Id.Should().Be(customerDetails.Id);
            result.Firstname.Should().Be(customerDetails.Firstname);
            result.Lastname.Should().Be(customerDetails.Lastname);
            result.Email.Should().Be(customerDetails.Email);
            result.Accounts.Should().NotBeNull().And.BeEmpty();
            result.TotalBalance.Should().Be(customerDetails.TotalBalance);
        }