Example #1
0
        public void Fail_If_FilePath_DoesNot_Exist()
        {
            // Arrange
            var test = new TestContainer();

            const string FilePath = "file-path";

            test.FileSystem.Setup(m => m.FileExists(FilePath))
            .Returns(false);

            var importer = test.RegisterAll().Resolve <VirtualMachineImporter>();

            // Act
            var ex = TestAssistant.CatchException(() => importer.Import(FilePath, "some-name"));

            // Assert
            Assert.IsNotNull(ex);
        }
Example #2
0
        public void Name_Should_Not_Be_Empty()
        {
            // Arrange
            const string Path     = "some-path";
            var          importer = GenerateTestContainer().RegisterAll().Resolve <VirtualMachineImporter>();

            // Act
            var validCase = TestAssistant.CatchException(() => importer.Import(Path, "some-name"));
            var invalid1  = TestAssistant.CatchException(() => importer.Import(Path, "   "));
            var invalid2  = TestAssistant.CatchException(() => importer.Import(Path, string.Empty));
            var invalid3  = TestAssistant.CatchException(() => importer.Import(Path, null));

            // Assert
            Assert.IsNull(validCase);
            Assert.IsNotNull(invalid1);
            Assert.IsNotNull(invalid2);
            Assert.IsNotNull(invalid3);
        }