public void Should_throw_if_there_are_several_database_configuration_information() { //Arrange var fileLoaderMock = new Mock <IFileLoaderAgent>(MockBehavior.Strict); fileLoaderMock.Setup(x => x.ReadAllText("File1.xml")).Returns(() => "<Database><Url>A</Url><Username>A</Username><Password>A</Password><Name>A</Name></Database>"); fileLoaderMock.Setup(x => x.ReadAllText("File2.xml")).Returns(() => "<Database><Url>A</Url><Username>A</Username><Password>A</Password><Name>A</Name></Database>"); var configBusiness = new ConfigBusiness(fileLoaderMock.Object); IConfig config = null; Exception exception = null; //Act try { config = configBusiness.LoadFiles(new[] { "File1.xml", "File2.xml" }); } catch (Exception exp) { exception = exp; } //Assert Assert.That(config, Is.Not.Null); Assert.That(exception, Is.Null); Assert.That(config.Databases.Count, Is.EqualTo(2)); }