Exemple #1
0
        public async Task <ActionResult <GroupDto> > Execute(Guid id)
        {
            var response = await _getGroupUseCase.Execute(id);

            if (response == null)
            {
                return(NotFound());
            }

            return(Ok(response));
        }
        public async Task Should_CreateGroupUseCase(string name, string inep, string namePublicSchool, string zipCode, string baseAddress, string complementAddress, string neighborhood, string city, Domain.Shared.ValueObjects.Addresses.State state)
        {
            CreatePublicSchoolRequest createPublicSchoolRequest = new CreatePublicSchoolRequest()
            {
                Inep    = inep,
                Name    = namePublicSchool,
                Address = new AddressDto()
                {
                    ZipCode           = zipCode,
                    BaseAddress       = baseAddress,
                    ComplementAddress = complementAddress,
                    Neighborhood      = neighborhood,
                    City  = city,
                    State = state
                }
            };

            await _createPublicSchoolUseCase.Execute(createPublicSchoolRequest);

            CreateGroupRequest createGroupRequest = new CreateGroupRequest()
            {
                Inep = inep,
                Name = name
            };

            await _createGroupUseCase.Execute(createGroupRequest);

            var groups = await _getGroupsUseCase.Execute(inep);

            groups.Should().NotBeNull();
            groups.Should().OnlyHaveUniqueItems();

            foreach (var g in groups)
            {
                var existentGroup = await _getGroupUseCaso.Execute(g.Id);

                existentGroup.Should().NotBeNull();
                existentGroup.Should().BeEquivalentTo(g);
            }
        }