Beispiel #1
0
        public void Collect_AsImplementedInterface_Multiple()
        {
            // Arrange
            var applier   = new FakeApplier();
            var collector = Create(typeof(ServiceAsImplementedInterfaceMultiple));

            // Act + Assert
            Assert.Throws <InvalidOperationException>(() => collector.Collect(applier));
        }
Beispiel #2
0
        public void Collect()
        {
            // Assert
            var applier   = new FakeApplier();
            var collector = Create(typeof(Service1));

            // Act
            collector.Collect(applier);

            // Assert
            applier.Contexts.Should().Contain(c => c.Implementation == typeof(Service1));
        }
Beispiel #3
0
        public void Collect_CollectsTags(string tag)
        {
            // Arrange
            var applier   = new FakeApplier();
            var collector = Create(typeof(Service3));

            // Act
            collector.Collect(applier, tag);

            // Assert
            applier.Contexts.Should().Contain(c => c.Implementation == typeof(Service3));
        }
        public void Collect_DoesNotCollectDifferentTags(string tag)
        {
            // Arrange
            var applier   = new FakeApplier();
            var collector = Create();

            // Act
            collector.Collect(applier, tag);

            // Assert
            applier.Contexts.Should().NotContain(c => c.Service == typeof(Service3));
        }
Beispiel #5
0
        public void Collect_Multiple()
        {
            // Arrange
            var applier   = new FakeApplier();
            var collector = Create(typeof(Service2));

            // Act
            collector.Collect(applier);

            // Assert
            applier.Contexts.Should().Contain(c =>
                                              c.Implementation == typeof(Service2) && c.Service == typeof(Service2)).And.Contain((c) =>
                                                                                                                                 c.Implementation == typeof(Service2) && c.Service == typeof(IService2));
        }
Beispiel #6
0
        public void Collect_AsImplementedInterface_One()
        {
            // Arrange
            var applier   = new FakeApplier();
            var collector = Create(typeof(ServiceAsImplementedInterfaceOne));

            // Act
            collector.Collect(applier);

            // Assert
            var c = applier.Contexts.First();

            c.Service.Should().Be(typeof(IServiceAsImplementedInterface1));
        }
Beispiel #7
0
        public void Collect_MultipleTags()
        {
            // Arrange
            var applier1   = new FakeApplier();
            var applier2   = new FakeApplier();
            var collector1 = Create(typeof(Service4));
            var collector2 = Create(typeof(Service4));

            // Act
            collector1.Collect(applier1, "foo");
            collector2.Collect(applier2, "bar");

            // Assert
            applier1.Contexts.Should().Contain(c => c.Implementation == typeof(Service4));
            applier2.Contexts.Should().Contain(c => c.Implementation == typeof(Service4));
        }