Ejemplo n.º 1
0
        public void WhenGettingHandlerTypesThrowReflectionTypeLoadExceptionThenReturnsEmptyCollection()
        {
            // Assign
            DefaultCommandHandlerTypeResolver resolver = this.CreateTestableService();

            this.assembliesResolver.Setup(r => r.GetAssemblies()).Returns(new Assembly[] { new ThrowingExceptionAssembly() });

            // Act
            var result = resolver.GetCommandHandlerTypes(this.assembliesResolver.Object);

            // Assert
            Assert.NotNull(result);
            Assert.Equal(0, result.Count);
        }
Ejemplo n.º 2
0
        public void WhenGettingHandlerTypesThenReturnsCollection()
        {
            // Assign
            DefaultCommandHandlerTypeResolver resolver = this.CreateTestableService();

            this.assembliesResolver.Setup(r => r.GetAssemblies()).Returns(new Assembly[] { new ValidAssembly() });

            // Act
            var result = resolver.GetCommandHandlerTypes(this.assembliesResolver.Object);

            // Assert
            Assert.NotNull(result);
            Assert.Equal(1, result.Count);
            Assert.Equal(typeof(SimpleCommandHandler), result.First());
        }