Exemplo n.º 1
0
        public void WithUpconvertersFrom_NullAssembly_ShouldThrowArgumentNullException()
        {
            // Arrange
            var sut = new ConfigurationStub();

            // Act
            var exception = Record.Exception(() => sut.WithUpconvertersFrom((Assembly)null));

            // Assert
            exception.Should().NotBeNull();
            exception.Should().BeOfType <ArgumentNullException>();
        }
Exemplo n.º 2
0
        public void WithUpconvertersFrom_UpconverterContainerAssembly_ShouldNotThrowException()
        {
            // Arrange
            var sut = new ConfigurationStub();

            // Act
            var exception = Record.Exception(() => sut.WithUpconvertersFrom(typeof(BullOak.Repositories.Test.Unit.UpconverterContainer.EventA).Assembly)
                                             .AndNoMoreUpconverters()
                                             .Build());

            // Assert
            exception.Should().BeNull();
        }
Exemplo n.º 3
0
        public void WithUpconvertersFrom_UpconverterContainerAssembly_ShouldLoadInternalUpconvertersOfInternalEvents()
        {
            // Arrange
            var sut = new ConfigurationStub();

            // Act
            sut.WithUpconvertersFrom(typeof(BullOak.Repositories.Test.Unit.UpconverterContainer.EventA).Assembly)
            .AndNoMoreUpconverters()
            .Build();

            // Assert
            sut.GetUpconvertFunctions()
            .Any(x => x.Key.Name.Equals("InternalEvent"))
            .Should().BeTrue();
        }
Exemplo n.º 4
0
        public void WithUpconvertersFrom_OneUpconverterTypeAndOneOtherType_ShouldNotThrowException()
        {
            // Arrange
            var sut  = new ConfigurationStub();
            var data = new Type[]
            {
                GetType(),
                typeof(UpconverterAToB)
            };

            // Act
            var build = sut.WithUpconvertersFrom(data)
                        .AndNoMoreUpconverters();
            var exception = Record.Exception(() => build.Build());

            // Assert
            exception.Should().BeNull();
        }
Exemplo n.º 5
0
        public void WithUpconvertersFrom_OneUpconverterTypeAndOneOtherType_ShouldAddOneUpconverterInList()
        {
            // Arrange
            var sut  = new ConfigurationStub();
            var data = new Type[]
            {
                GetType(),
                typeof(UpconverterAToB)
            };

            // Act
            sut.WithUpconvertersFrom(data)
            .AndNoMoreUpconverters()
            .Build();

            // Assert
            var upconvertFuncs = sut.GetUpconvertFunctions();

            upconvertFuncs.Should().NotBeNull();
            upconvertFuncs.Length.Should().Be(1);
            upconvertFuncs[0].Key.Should().Be <EventA>();
        }