Пример #1
0
        public void VerifyPaging_DefaultValues()
        {
            // Arrange
            var smartObject = SmartObjectFactory.GetSmartObject(SmartObjectOption.ProcessInfo);

            smartObject.MethodToExecute = smartObject.Methods[0].Name;

            DataTable dataTable1 = DataTableFactory.GetDataTableWithOneColumnAndOneRow();

            SmartObjectClientServer server = null;

            MockWrapperFactory.Instance.SmartObjectClientServer
            .Setup(x => x.ExecuteListDataTable(
                       It.IsAny <SmartObject>(),
                       It.IsAny <ExecuteListOptions>()))
            .Returns(dataTable1);

            MockWrapperFactory.Instance.SmartObjectClientServer
            .Setup(x => x.ExecuteListReader(
                       It.IsAny <SmartObject>(),
                       It.IsAny <ExecuteListReaderOptions>()))
            .Returns(default(SmartObjectReader));

            // Action
            SmartObjectHelper.VerifyPaging(server, smartObject, 0);
        }
Пример #2
0
        public void VerifyAllReturnPropertiesHasValues_WithMethod_NoReturn()
        {
            // Arrange
            var smartObject = SmartObjectFactory.GetSmartObject(SmartObjectOption.ProcessInfo);

            // Action
            SmartObjectHelper.VerifyAllReturnPropertiesHasValues(smartObject.Methods[0]);
        }
Пример #3
0
        public void VerifyAllReturnPropertiesHasValues_WithNull()
        {
            // Arrange
            SmartMethodBase method = null;

            // Action
            SmartObjectHelper.VerifyAllReturnPropertiesHasValues(method);
        }
Пример #4
0
        public void CompareDataTables()
        {
            // Arrange
            DataTable dataTable1 = DataTableFactory.GetDataTableWithOneColumnAndOneRow();

            // Action
            SmartObjectHelper.CompareDataTables(dataTable1, dataTable1.DefaultView.ToTable());
        }
Пример #5
0
        public void GetServiceInstance_IsNull()
        {
            // Action
            var serviceConfig = SmartObjectHelper.GetServiceInstance(Guid.NewGuid());

            // Assert
            Assert.IsNull(serviceConfig);
        }
Пример #6
0
        public void ExecuteSQLQueryDataTable_DefaultValues()
        {
            // Arrange
            SmartObjectClientServer server = null;

            // Action
            SmartObjectHelper.ExecuteSQLQueryDataTable(server, "SELECT * FROM REGION");
        }
Пример #7
0
        public void ExecuteBulkScalar_DefaultValues()
        {
            // Arrange
            SmartObjectClientServer server = null;
            var smartObject = SmartObjectFactory.GetSmartObject(SmartObjectOption.ProcessInfo);

            // Action
            SmartObjectHelper.ExecuteBulkScalar(server, smartObject, new DataTable());
        }
Пример #8
0
        public void ExecuteListReader_DefaultValues()
        {
            // Arrange
            SmartObjectClientServer server = null;
            var smartObject = SmartObjectFactory.GetSmartObject(SmartObjectOption.ProcessInfo);

            // Action
            SmartObjectHelper.ExecuteListReader(server, smartObject);
        }
Пример #9
0
        internal DataTable DeserializeTypedArray(string serviceObjectName, ServiceInstanceSettings serviceInstanceSettings, string value)
        {
            var smartObject = SmartObjectHelper.GetSmartObject(this, serviceObjectName, serviceInstanceSettings);

            smartObject.MethodToExecute = "DeserializeTypedArray";
            smartObject.SetInputPropertyValue("Serialized_Array", value);

            var dataTable = SmartObjectHelper.ExecuteListDataTable(this, smartObject);

            return(dataTable);
        }
Пример #10
0
        internal SmartObject Deserialize(string serviceObjectName, ServiceInstanceSettings serviceInstanceSettings, string value)
        {
            var smartObject = SmartObjectHelper.GetSmartObject(this, serviceObjectName, serviceInstanceSettings);

            smartObject.MethodToExecute = "Deserialize";
            smartObject.SetInputPropertyValue("Serialized_Item__String_", value);

            SmartObjectHelper.ExecuteScalar(this, smartObject);

            return(smartObject);
        }
Пример #11
0
        public void GetSmartObject_DefaultValues()
        {
            // Arrange
            SmartObjectClientServer server = null;

            MockWrapperFactory.Instance.WithProcessInstanceSmartObject(out SmartObject expected, out ServiceInstanceSettings settings);

            // Action
            var actual = SmartObjectHelper.GetSmartObject(server, Guid.NewGuid().ToString(), Mock.Of <ServiceInstanceSettings>());

            // Assert
            Assert.AreEqual(expected, actual);
        }
Пример #12
0
        public void GetSmartObjectDefinition_DefaultValues()
        {
            // Arrange
            MockWrapperFactory.Instance.SmartObjectManagementServer
            .Setup(i => i.GetSmartObjectDefinition(
                       It.IsAny <string>()))
            .Returns(Resources.SmartObjectDefinition_ProcessInfo);

            // Action
            var actual = SmartObjectHelper.GetSmartObjectDefinition(Guid.NewGuid().ToString());

            // Assert
            Assert.IsNotNull(actual);
        }
Пример #13
0
        public void GetServiceInstance_WithGuid()
        {
            // Arrange
            MockWrapperFactory.Instance.ServiceManagementServer
            .Setup(i => i.GetServiceInstanceCompact(
                       It.IsAny <Guid>()))
            .Returns(Resources.ServiceInstance_URMService);

            // Action
            var serviceConfig = SmartObjectHelper.GetServiceInstance(Guid.NewGuid());

            // Assert
            Assert.IsNotNull(serviceConfig);
        }
Пример #14
0
        public void GetServiceType_Null()
        {
            // Action
            MockWrapperFactory.Instance.ServiceManagementServer
            .Setup(i => i.GetServiceType(
                       It.IsAny <Guid>()))
            .Returns(string.Empty);

            // Action
            var serviceType = SmartObjectHelper.GetServiceType(Guid.NewGuid());

            // Assert
            Assert.IsNull(serviceType);
        }
Пример #15
0
        public void GetServiceTypeInfo_DefaultValues()
        {
            // Action
            MockWrapperFactory.Instance.ServiceManagementServer
            .Setup(i => i.GetServiceType(
                       It.IsAny <Guid>()))
            .Returns(Resources.ServiceType_ADService);

            // Action
            var serviceType = SmartObjectHelper.GetServiceTypeInfo(Guid.NewGuid());

            // Assert
            Assert.IsNotNull(serviceType);
        }
Пример #16
0
        public void GetServiceInstance_WithServiceInstanceSettings()
        {
            // Arrange
            MockWrapperFactory.Instance.SmartObjectManagementServer
            .Setup(i => i.GetServiceInstance(
                       It.IsAny <Guid>(),
                       It.IsAny <ServiceExplorerLevel>()))
            .Returns(Resources.ServiceInstance_URMService);

            // Action
            var serviceConfig = SmartObjectHelper.GetServiceInstance(Mock.Of <ServiceInstanceSettings>());

            // Assert
            Assert.IsNotNull(serviceConfig);
        }
Пример #17
0
        public void GetServiceObject_DefaultValues()
        {
            // Arrange
            MockWrapperFactory.Instance.SmartObjectManagementServer
            .Setup(i => i.GetServiceInstanceServiceObject(
                       It.IsAny <Guid>(),
                       It.IsAny <string>()))
            .Returns(Resources.ServiceObject_ProcessOverview);

            // Action
            var serviceObject = SmartObjectHelper.GetServiceObject(Mock.Of <ServiceInstanceSettings>(), Guid.NewGuid().ToString());

            // Assert
            Assert.IsNotNull(serviceObject);
        }
Пример #18
0
        internal string SerializeItemToArray(string serviceObjectName, ServiceInstanceSettings serviceInstanceSettings, params Action <SmartObject>[] actions)
        {
            actions.ThrowIfNull("actions");

            var smartObject = SmartObjectHelper.GetSmartObject(this, serviceObjectName, serviceInstanceSettings);

            smartObject.MethodToExecute = "SerializeItemToArray";

            foreach (var action in actions)
            {
                action(smartObject);
            }

            SmartObjectHelper.ExecuteScalar(this, smartObject);

            return(smartObject.Properties["Serialized_Array"].Value);
        }
Пример #19
0
        internal string Serialize(string serviceObjectName, ServiceInstanceSettings serviceInstanceSettings, params Action <SmartObject>[] actions)
        {
            actions.ThrowIfNull("actions");

            var smartObject = SmartObjectHelper.GetSmartObject(this, serviceObjectName, serviceInstanceSettings);

            smartObject.MethodToExecute = "Serialize";

            foreach (var action in actions)
            {
                action(smartObject);
            }

            var serialized = SmartObjectHelper.ExecuteScalar(this, smartObject);

            return(serialized.GetReturnPropertyValue("Serialized_Item__String_"));
        }
Пример #20
0
        public void DeleteSmartObject_SmartObjectNotExists()
        {
            // Arrange
            var smartObjectInfo = SmartObjectInfo.Create(Resources.SmartObjectDefinition_ProcessInfo);
            SmartObjectManagementServer smartObjectManagementServer = null;
            var mockSmartObjectExplorer = Mock.Of <SmartObjectExplorer>();

            mockSmartObjectExplorer.SmartObjects.Add(smartObjectInfo);

            MockWrapperFactory.Instance.SmartObjectManagementServer
            .Setup(i => i.GetSmartObjects(
                       It.IsAny <string>()))
            .Returns(mockSmartObjectExplorer);

            // Action
            SmartObjectHelper.DeleteSmartObject(smartObjectManagementServer, Guid.NewGuid().ToString());
        }
Пример #21
0
        public void PublishSmartObjectsFromResources_DefaultValues()
        {
            // Arrange
            var smartObjectInfo         = SmartObjectInfo.Create(Resources.SmartObjectDefinition_ProcessInfo);
            var mockSmartObjectExplorer = Mock.Of <SmartObjectExplorer>();

            mockSmartObjectExplorer.SmartObjects.Add(smartObjectInfo);

            MockWrapperFactory.Instance.SmartObjectManagementServer
            .Setup(i => i.GetSmartObjects(
                       It.IsAny <string>()))
            .Returns(mockSmartObjectExplorer);

            var smartObjectDefinitionsPublish = new SmartObjectDefinitionsPublish();

            smartObjectDefinitionsPublish.SmartObjects.Add(new SmartObjectDefinition());

            // Action
            SmartObjectHelper.PublishSmartObjectsFromResources(this.GetType().Assembly, null);
        }
Пример #22
0
        public void GetSmartObjects_DefaultValues()
        {
            // Arrange
            var expected = SmartObjectInfo.Create(Resources.SmartObjectDefinition_ProcessInfo);

            var mockSmartObjectExplorer = Mock.Of <SmartObjectExplorer>();

            mockSmartObjectExplorer.SmartObjects.Add(expected);

            MockWrapperFactory.Instance.SmartObjectManagementServer
            .Setup(i => i.GetSmartObjects(
                       It.IsAny <Guid[]>()))
            .Returns(mockSmartObjectExplorer);

            // Action
            var actual = SmartObjectHelper.GetSmartObjects(new Guid[] { });

            // Assert
            Assert.AreEqual(expected, actual.FirstOrDefault());
        }
Пример #23
0
        public void ContainsSmartObject()
        {
            // Arrange
            var smartObjectInfo = SmartObjectInfo.Create(Resources.SmartObjectDefinition_ProcessInfo);
            SmartObjectManagementServer smartObjectManagementServer = null;
            var mockSmartObjectExplorer = Mock.Of <SmartObjectExplorer>();

            mockSmartObjectExplorer.SmartObjects.Add(smartObjectInfo);

            MockWrapperFactory.Instance.SmartObjectManagementServer
            .Setup(i => i.GetSmartObjects(
                       It.IsAny <string>()))
            .Returns(mockSmartObjectExplorer);

            // Action
            var actual = SmartObjectHelper.ContainsSmartObject(smartObjectManagementServer, smartObjectInfo.Name);

            // Assert
            Assert.IsTrue(actual);
        }