Beispiel #1
0
        public async Task Gets_group_info_without_students()
        {
            var group = Fixture.DataMother.CreateGroup();

            using var ucConnection      = Fixture.CreateDbConnection();
            await using var ucDbContext = Fixture.CreateDbContext();
            var useCase = new StudentGroupGetDetails(ucConnection, ucDbContext);

            var result = await useCase.HandleAsync(new StudentGroupGetDetails.Request(group.Id));

            result.Should().NotBeNull();
            result !.Name.Should().Be(group.Name);
            result !.Mnemonic.Should().Be(group.Mnemonic);
            result !.Students.Should().BeNullOrEmpty();
        }
Beispiel #2
0
        public async Task Can_create_a_group()
        {
            var request = new GroupCreate.Request
            {
                Name        = "S3 - Leon",
                Mnemonic    = null,
                StartPeriod = new DateTime(2020, 9, 1)
            };

            var result = await ActUseCase(useCase => useCase.HandleAsync(request));

            Assert.True(result.IsSuccess);
            await using var assertDb = new ProgressContext(Fixture.ContextOptions);
            var group = assertDb.Groups.FirstOrDefault();

            assertDb.Groups.Should().HaveCount(1);
            group.Should().NotBeNull();
            group !.Name.Value.Should().Be("S3 - Leon");
            group !.Mnemonic.Should().Be(null);
        }