예제 #1
0
        public async Task Store_returns_newly_created_organization()
        {
            // Arrange

            var sut          = new OrganizationSqlRepository(_context);
            var organization = new Organization(Guid.NewGuid().ToString());

            // Act

            await sut.Store(organization);

            // Assert

            var reconstitutedOrganization = await sut.GetBy(organization.Identifier);

            reconstitutedOrganization.Name.ShouldBe(organization.Name);
            reconstitutedOrganization.IsEnabled.ShouldBe(organization.IsEnabled);
        }
예제 #2
0
        public async Task Store_updates_existing_organization()
        {
            // Arrange

            var newName      = Guid.NewGuid().ToString();
            var sut          = new OrganizationSqlRepository(_context);
            var organization = new Organization(Guid.NewGuid().ToString());
            await sut.Store(organization);

            organization.UpdateName(newName);

            // Act

            await sut.Store(organization);

            // Assert

            var reconstitutedOrganization = await sut.GetBy(organization.Identifier);

            reconstitutedOrganization.Name.Name.ShouldBe(newName);
        }