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

            await _dbContext.AccountsDetails.InsertOneAsync(model);
        }
Пример #2
0
        public async Task GetDetails_should_return_account_details()
        {
            var expectedAccount = new Core.Queries.Models.AccountDetails(Guid.NewGuid(), Guid.NewGuid(),
                                                                         "John", "Doe", new Domain.Money(Domain.Currency.CanadianDollar, 42));

            await _fixture.QueryModelsSeeder.CreateAccountDetails(expectedAccount);

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

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

            var account = await response.Content.ReadAsAsync <Core.Queries.Models.AccountDetails>();

            account.Should().NotBeNull();
            account.Id.Should().Be(expectedAccount.Id);
            account.OwnerFirstName.Should().Be(expectedAccount.OwnerFirstName);
            account.OwnerLastName.Should().Be(expectedAccount.OwnerLastName);
            account.OwnerId.Should().Be(expectedAccount.OwnerId);
            account.Balance.Should().Be(expectedAccount.Balance);
        }