Esempio n. 1
0
            public async Task QueryContainerInformationOfNotCreatedContainer()
            {
                // Given
                var testcontainersBuilder = new TestcontainersBuilder <TestcontainersContainer>()
                                            .WithImage("nginx");

                // When
                // Then
                await using (ITestcontainersContainer testcontainer = testcontainersBuilder.Build())
                {
                    Assert.Throws <InvalidOperationException>(() => testcontainer.Name);
                    Assert.Throws <InvalidOperationException>(() => testcontainer.IpAddress);
                    Assert.Throws <InvalidOperationException>(() => testcontainer.MacAddress);
                    Assert.Throws <InvalidOperationException>(() => testcontainer.GetMappedPublicPort(0));
                    await Assert.ThrowsAsync <InvalidOperationException>(() => testcontainer.StopAsync());
                }
            }