public void ValidationPassedWhenProjectDiffersButNameIsSame() { Store store = new Store(typeof(CoreDesignSurfaceDomainModel), typeof(HostDesignerDomainModel)); using (Transaction t = store.TransactionManager.BeginTransaction()) { ClientApplication clientApp1 = new ClientApplication(store, new PropertyAssignment(ClientApplication.ImplementationProjectDomainPropertyId, "Project1")); ClientApplication clientApp2 = new ClientApplication(store, new PropertyAssignment(ClientApplication.ImplementationProjectDomainPropertyId, "AnotherProject")); HostDesignerModel model = new HostDesignerModel(store); model.ClientApplications.Add(clientApp1); model.ClientApplications.Add(clientApp2); Proxy proxy1 = new Proxy(store, new PropertyAssignment(Proxy.NameDomainPropertyId, "Proxy1")); Proxy proxy2 = new Proxy(store, new PropertyAssignment(Proxy.NameDomainPropertyId, "Proxy1")); clientApp1.Proxies.Add(proxy1); clientApp2.Proxies.Add(proxy2); TestableHostModelContainsUniqueProxyNamesAcrossClientsValidator validator = new TestableHostModelContainsUniqueProxyNamesAcrossClientsValidator(); t.Rollback(); } }
public void ValidationFailsWhenTwoProxiesHaveSameNameAndProject() { Store store = new Store(typeof(CoreDesignSurfaceDomainModel), typeof(HostDesignerDomainModel)); using (Transaction t = store.TransactionManager.BeginTransaction()) { ClientApplication clientApp1 = new ClientApplication(store, new PropertyAssignment(ClientApplication.ImplementationProjectDomainPropertyId, "Project1")); ClientApplication clientApp2 = new ClientApplication(store, new PropertyAssignment(ClientApplication.ImplementationProjectDomainPropertyId, "Project1")); HostDesignerModel model = new HostDesignerModel(store); model.ClientApplications.Add(clientApp1); model.ClientApplications.Add(clientApp2); Proxy proxy1 = new Proxy(store, new PropertyAssignment(Proxy.NameDomainPropertyId, "Proxy1")); Proxy proxy2 = new Proxy(store, new PropertyAssignment(Proxy.NameDomainPropertyId, "Proxy1")); clientApp1.Proxies.Add(proxy1); clientApp2.Proxies.Add(proxy2); TestableHostModelContainsUniqueProxyNamesAcrossClientsValidator validator = new TestableHostModelContainsUniqueProxyNamesAcrossClientsValidator(); Assert.IsFalse(validator.IsValid(model)); t.Rollback(); } }
public void ValidationOnlyAppliesToServicesReferencesInDifferentHosts() { Store store = new Store(typeof(CoreDesignSurfaceDomainModel), typeof(HostDesignerDomainModel)); using (Transaction t = store.TransactionManager.BeginTransaction()) { ClientApplication clientApp = new ClientApplication(store, new PropertyAssignment(ClientApplication.ImplementationProjectDomainPropertyId, "Project1")); HostDesignerModel model = new HostDesignerModel(store); model.ClientApplications.Add(clientApp); Proxy proxy1 = new Proxy(store, new PropertyAssignment(Proxy.NameDomainPropertyId, "Proxy1")); Proxy proxy2 = new Proxy(store, new PropertyAssignment(Proxy.NameDomainPropertyId, "Proxy1")); clientApp.Proxies.Add(proxy1); clientApp.Proxies.Add(proxy2); TestableHostModelContainsUniqueProxyNamesAcrossClientsValidator validator = new TestableHostModelContainsUniqueProxyNamesAcrossClientsValidator(); Assert.IsTrue(validator.IsValid(model)); t.Rollback(); } }
public void ValidationOnlyAppliesToServicesReferencesInDifferentHosts() { Store store = new Store(typeof(CoreDesignSurfaceDomainModel), typeof(HostDesignerDomainModel)); using (Transaction t = store.TransactionManager.BeginTransaction()) { ClientApplication clientApp = new ClientApplication(store, new PropertyAssignment(ClientApplication.ImplementationProjectDomainPropertyId, "Project1")); HostDesignerModel model = new HostDesignerModel(store); model.ClientApplications.Add(clientApp); Proxy proxy1 = new Proxy(store, new PropertyAssignment(Proxy.NameDomainPropertyId, "Proxy1")); Proxy proxy2 = new Proxy(store, new PropertyAssignment(Proxy.NameDomainPropertyId, "Proxy1")); clientApp.Proxies.Add(proxy1); clientApp.Proxies.Add(proxy2); TestableHostModelContainsUniqueProxyNamesAcrossClientsValidator validator = new TestableHostModelContainsUniqueProxyNamesAcrossClientsValidator(); Assert.IsTrue(validator.IsValid(model)); t.Rollback(); } }