public void CorrectlyInferViewModelName_WhenNoSuffixes()
        {
            var sut = new SetDataContextCommandLogic(
                TestProfile.CreateEmpty(),
                DefaultTestLogger.Create(),
                new TestVisualStudioAbstraction(),
                new TestFileSystem());

            var(view, viewModel, _) = sut.InferViewModelNameFromFileName("Test.xaml.cs");

            Assert.AreEqual("Test", view);
            Assert.AreEqual("Test", viewModel);
        }
        public void CorrectlyInferViewModelName_OnlyCodeBehindSuffixConfigured()
        {
            var profile = TestProfile.CreateEmpty();

            profile.ViewGeneration.ViewModelFileSuffix = "ViewModel";

            var sut = new SetDataContextCommandLogic(
                profile,
                DefaultTestLogger.Create(),
                new TestVisualStudioAbstraction(),
                new TestFileSystem());

            var(view, viewModel, _) = sut.InferViewModelNameFromFileName("TestPage.xaml.cs");

            Assert.AreEqual("TestPage", view);
            Assert.AreEqual("TestPageViewModel", viewModel);
        }
        public void CorrectlyInferViewModelName_BothSuffixesConfigured_NonStandard()
        {
            var profile = TestProfile.CreateEmpty();

            profile.ViewGeneration.XamlFileSuffix      = "Foo";
            profile.ViewGeneration.ViewModelFileSuffix = "Bar";

            var sut = new SetDataContextCommandLogic(
                profile,
                DefaultTestLogger.Create(),
                new TestVisualStudioAbstraction(),
                new TestFileSystem());

            var(view, viewModel, _) = sut.InferViewModelNameFromFileName("TestFoo.xaml.cs");

            Assert.AreEqual("TestFoo", view);
            Assert.AreEqual("TestBar", viewModel);
        }
        public void CorrectlyInferViewModelNameSpace()
        {
            var profile = TestProfile.CreateEmpty();

            profile.ViewGeneration.ViewModelDirectoryName = "VMS";

            var sut = new SetDataContextCommandLogic(
                profile,
                DefaultTestLogger.Create(),
                new TestVisualStudioAbstraction
            {
                ActiveProject = new ProjectWrapper {
                    Name = "TestApp"
                },
            },
                new TestFileSystem());

            var(_, _, vmNamespace) = sut.InferViewModelNameFromFileName("Test.xaml.cs");

            Assert.AreEqual("TestApp.VMS", vmNamespace);
        }