public void CreateDuplicateRootContainer_Data_Name() { EAV.Store.Clients.IContainerStoreClient client = factory.Create <EAV.Store.Clients.IContainerStoreClient>(); int contextID = SelectRandomItem(this.DbContext.Contexts).Context_ID; string containerName = Guid.NewGuid().ToString(); EAV.Store.IStoreContainer container = client.CreateRootContainer(new EAVStoreLibrary.StoreContainer() { Name = containerName, DataName = containerName.ToUpper(), DisplayText = containerName + ":", Sequence = rng.Next(), }, contextID); Assert.IsNotNull(container, "Failed to create container with name '{0}' for context ID {1}.", containerName, contextID); client.CreateRootContainer(new EAVStoreLibrary.StoreContainer() { Name = containerName + "1", DataName = containerName.ToUpper(), DisplayText = containerName + ":", Sequence = rng.Next(), }, contextID); Assert.Fail("Failed to throw exception creating root container with duplicate data name."); }
public void CreateRootContainer() { EAV.Store.Clients.IContainerStoreClient client = factory.Create <EAV.Store.Clients.IContainerStoreClient>(); int contextID = SelectRandomItem(this.DbContext.Contexts).Context_ID; string containerName = Guid.NewGuid().ToString(); EAV.Store.IStoreContainer container = client.CreateRootContainer(new EAVStoreLibrary.StoreContainer() { Name = containerName, DataName = containerName.ToUpper(), DisplayText = containerName + ":", Sequence = rng.Next(), }, contextID); Assert.IsNotNull(container, "Failed to create container with name '{0}' for context ID {1}.", containerName, contextID); ResetDatabaseContext(); var dbContainer = this.DbContext.Containers.SingleOrDefault(it => it.Container_ID == container.ContainerID); Assert.IsNotNull(dbContainer, String.Format("Failed to retrieve container ID {0} from the database.", container.ContainerID)); Assert.IsNull(dbContainer.Parent_Container_ID, "Container has parent reference defined when it should not."); Assert.AreEqual(container.Name, dbContainer.Name, "Property 'Name' was not created correctly."); Assert.AreEqual(container.DataName, dbContainer.Data_Name, "Property 'DataName' was not created correctly."); Assert.AreEqual(container.DisplayText, dbContainer.Display_Text, "Property 'DisplayText' was not created correctly."); Assert.AreEqual(container.IsRepeating, dbContainer.Is_Repeating, "Property 'IsRepeating' was not created correctly."); Assert.AreEqual(container.Sequence, dbContainer.Sequence, "Property 'Sequence' was not created correctly."); }
public IHttpActionResult CreateRootContainer(int id, EAV.Store.IStoreContainer container) { try { return(Ok <EAV.Store.IStoreContainer>(containerClient.CreateRootContainer(container, id))); } catch (Exception ex) { return(InternalServerError(ex)); } }