コード例 #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);
        }