private TestServiceController CreateController()
        {
            TestServiceEntity model = new TestServiceEntity();
            model.PassedOid = "TestStatus:129";
            model.FailedOid = "TestStatus:155";
            model.ReferenceAttribute = "Reference";
            model.ChangeComment = "comment value";
            model.DescriptionSuffix = "modified by ServiceHost";
            model.CreateDefect = "CurrentIteration";
            model.BaseQueryFilter = "Reference='';Owners.Nickname='qc';Status.Name=''";

            model.Projects = new List<TestPublishProjectMapping>();
            TestPublishProjectMapping project = new TestPublishProjectMapping();
            project.DestinationProject = "Call Center";
            project.IncludeChildren = true;
            project.Name = "CallCenter";
            model.Projects.Add(project);

            return new TestServiceController(model, FacadeMock);
        }
        public void SaveConfigurationToFileInvalidDataTest()
        {
            var viewMock = MockRepository.StrictMock<IConfigurationView>();

            ExpectRegisterAndPrepareView(viewMock);
            var validationResult = new ConfigurationValidationResult();
            var invalidEntity = new TestServiceEntity();
            validationResult.AddEntity(invalidEntity, new List<string>());

            Expect.Call(FacadeMock.SaveConfigurationToFile(null, Filename)).IgnoreArguments().Return(validationResult);
            Expect.Call(uiFactoryMock.ResolvePageNameByEntity(invalidEntity)).Return("Tests");
            Expect.Call(() => viewMock.ShowErrorMessage(null)).IgnoreArguments();

            MockRepository.ReplayAll();

            var controller = new ConfigurationFormController(FacadeMock, uiFactoryMock);
            controller.RegisterView(viewMock);
            controller.PrepareView();
            controller.SaveToFile(Filename);

            MockRepository.VerifyAll();
        }
        /// <summary>
        /// Create valid TestServiceConfigurationEntity
        /// </summary>
        internal static TestServiceEntity CreateTestServiceEntity()
        {
            var entity = new TestServiceEntity {
                ReferenceAttribute = "Reference",
                BaseQueryFilter = "Reference='';Owners.Nickname='qc';Status.Name=''",
                PassedOid = "TestStatus:129",
                FailedOid = "TestStatus:155",
                CreateDefect = "All",
                DescriptionSuffix = "Description suffix",
                ChangeComment = "Updated by VersionOne.ServiceHost"
            };

            return entity;
        }