public static void CheckComponent(GetOrCreateComponentData createData, Api.ComponentInfo info) { Assert.Equal(createData.SystemName, info.SystemName); Assert.Equal(createData.DisplayName, info.DisplayName); Assert.Equal(createData.Version, info.Version); CheckExtentionProperties(createData.Properties, info.Properties); }
public static void CheckComponent(GetOrCreateComponentData createData, IComponentControl control) { Assert.False(control.IsFake()); CheckComponent(createData, control.Info); Assert.Equal(createData.SystemName, control.SystemName); Assert.Equal(createData.Version, control.Version); }
public static GetOrCreateComponentData GetRandomGetOrCreateComponentData(IClient client) { var type = GetRandomComponentTypeControl(client); var systemName = "TestWebSite " + Guid.NewGuid(); var data = new GetOrCreateComponentData(systemName, type) { Version = GetRandomVersion(), DisplayName = systemName + " display name" }; InitRandomProperties(data.Properties); return(data); }
public void Test1() { // отправка от компонента без версии var account = TestHelper.GetTestAccount(); var client = account.GetClient(); var root = client.GetRootComponentControl(); var type = client.GetOrCreateComponentTypeControl("testType"); var createData = new GetOrCreateComponentData("TestComponent" + Guid.NewGuid(), type) { Version = null }; var component = root.GetOrCreateChildComponentControl(createData); var eventData = component.CreateComponentEvent("Запуск ракеты"); var response = eventData.Send(); Assert.True(response.Success); var eventInfo = client.ApiService.GetEventById(response.Data.EventId).Data; Assert.Null(eventInfo.Version); // установим компоненту версию 1.0 createData.Version = "1.0"; component = root.GetOrCreateChildComponentControl(createData); eventData = component.CreateComponentEvent("Запуск ракеты"); //component.Info.Version = "1.0"; response = eventData.Send(); Assert.True(response.Success); eventInfo = client.ApiService.GetEventById(response.Data.EventId).Data; Assert.Equal("1.0", eventInfo.Version); // укажем у события версию явно 2.0 eventData.Version = "2.0"; response = eventData.Send(); Assert.True(response.Success); eventInfo = client.ApiService.GetEventById(response.Data.EventId).Data; Assert.Equal("2.0", eventInfo.Version); // проверим, что у компонента версия не поменялась eventData.Version = null; response = eventData.Send(); Assert.True(response.Success); eventInfo = client.ApiService.GetEventById(response.Data.EventId).Data; Assert.Equal("1.0", eventInfo.Version); var componentCopy = component.Client.ApiService.GetComponentById(component.Info.Id); Assert.Equal("1.0", componentCopy.Data.Version); }
public static void CheckComponent( IComponentControl parent, IComponentTypeControl typeControl, GetOrCreateComponentData createData, IComponentControl component) { Assert.False(component.IsFake()); Assert.NotNull(component.Info); Assert.Equal(createData.DisplayName, component.Info.DisplayName); Assert.Equal(createData.SystemName, component.SystemName); Assert.Equal(createData.SystemName, component.Info.SystemName); Assert.True(component.Info.CreatedDate > DateTime.Now.AddDays(-1)); Assert.True(component.Info.Id != Guid.Empty); Assert.NotNull(component.Info.ParentId); Assert.NotEqual(component.Info.ParentId, Guid.Empty); Assert.Equal(parent.Info.Id, component.Info.ParentId); Assert.Equal(typeControl.Info.Id, component.Info.Type.Id); Assert.Equal(typeControl.Info.Id, component.Type.Info.Id); Assert.Equal(createData.Version, component.Version); Assert.Equal(createData.Version, component.Info.Version); CheckExtentionProperties(createData.Properties, component.Info.Properties); }
public static GetOrCreateComponentRequestDtoData GetOrCreateComponentDataDto(Guid parentComponentId, GetOrCreateComponentData data) { if (data == null) { return(null); } var result = new GetOrCreateComponentRequestDtoData() { DisplayName = data.DisplayName, ParentComponentId = parentComponentId, Properties = GetExtentionPropertyDtos(data.Properties), SystemName = data.SystemName, Version = data.Version }; if (data.ComponentTypeControl != null) { result.TypeId = data.ComponentTypeControl.Info.Id; } return(result); }