Beispiel #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);
        }
Beispiel #2
0
        public void VerifyAllReturnPropertiesHasValues_WithMethod_NoReturn()
        {
            // Arrange
            var smartObject = SmartObjectFactory.GetSmartObject(SmartObjectOption.ProcessInfo);

            // Action
            SmartObjectHelper.VerifyAllReturnPropertiesHasValues(smartObject.Methods[0]);
        }
        public void SetInputPropertyValue_NullProperty()
        {
            //Arrange
            var smartObject = SmartObjectFactory.GetSmartObject(SmartObjectOption.ProcessInfo);

            // Action
            SmartObjectExtensions.SetInputPropertyValue(smartObject, null, null);
        }
        public void GetReturnProperties_NullMethod()
        {
            //Arrange
            var smartObject = SmartObjectFactory.GetSmartObject(SmartObjectOption.ProcessInfo);

            // Action
            SmartObjectExtensions.GetReturnProperties(smartObject);
        }
        public void GetPropertyValue_NullPropertyName()
        {
            //Arrange
            var smartObject = SmartObjectFactory.GetSmartObject(SmartObjectOption.ProcessInfo);

            // Action
            SmartObjectExtensions.GetPropertyValue <string>(smartObject, null);
        }
Beispiel #6
0
        public void ExecuteListReader_DefaultValues()
        {
            // Arrange
            SmartObjectClientServer server = null;
            var smartObject = SmartObjectFactory.GetSmartObject(SmartObjectOption.ProcessInfo);

            // Action
            SmartObjectHelper.ExecuteListReader(server, smartObject);
        }
Beispiel #7
0
        public void ExecuteBulkScalar_DefaultValues()
        {
            // Arrange
            SmartObjectClientServer server = null;
            var smartObject = SmartObjectFactory.GetSmartObject(SmartObjectOption.ProcessInfo);

            // Action
            SmartObjectHelper.ExecuteBulkScalar(server, smartObject, new DataTable());
        }
        public void WithProcessInstanceSmartObject(out SmartObject smartObject, out ServiceInstanceSettings serviceInstanceSettings)
        {
            smartObject = SmartObjectFactory.GetSmartObject(SmartObjectOption.ProcessInfo);
            var settings = new Mock <ServiceInstanceSettings>();

            settings.SetupGet(i => i.Name).Returns("K2_Management");

            var smartObjectInfo = SmartObjectInfo.Create(Resources.SmartObjectDefinition_ProcessInfo);

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

            mockSmartObjectExplorer.SmartObjects.Add(smartObjectInfo);

            this.SmartObjectManagementServer
            .Setup(i => i.GetSmartObjects(
                       It.IsAny <SearchProperty>(),
                       It.IsAny <SearchOperator>(),
                       It.IsAny <string>()))
            .Returns(mockSmartObjectExplorer);

            this.SmartObjectManagementServer
            .Setup(i => i.GetSmartObjects(
                       It.IsAny <Guid>()))
            .Returns(mockSmartObjectExplorer);

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

            this.SmartObjectClientServer
            .Setup(x => x.GetSmartObject(
                       It.IsAny <string>()))
            .Returns(smartObject);

            this.SmartObjectClientServer
            .Setup(x => x.ExecuteScalar(It.IsAny <SmartObject>()))
            .Returns(smartObject);

            this.ServiceManagementServer
            .Setup(i => i.GetServiceInstanceConfig(
                       It.IsAny <Guid>()))
            .Returns(Resources.ServiceInstanceConfig);

            this.ServiceManagementServer
            .Setup(i => i.GetServiceInstancesCompact(
                       It.IsAny <Guid>()))
            .Returns(Resources.ServiceInstancesCompact_URMService);

            this.ServiceManagementServer
            .Setup(i => i.GetServiceInstance(
                       It.IsAny <Guid>()))
            .Returns(Resources.ServiceInstance_URMService_Full);

            serviceInstanceSettings = settings.Object;
        }
        public void GetPropertyValue_InvalidProperty()
        {
            //Arrange
            var smartObject = SmartObjectFactory.GetSmartObject(SmartObjectOption.ProcessInfo);

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

            // Action
            SmartObjectExtensions.GetPropertyValue <int>(smartObject, Guid.NewGuid().ToString());
        }
        public void AddPropertyOrderBy_WithValidSmartObject()
        {
            //Arrange
            var smartObject = SmartObjectFactory.GetSmartObject(SmartObjectOption.ProcessInfo);

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

            // Action
            SmartObjectExtensions.AddPropertyOrderBy(smartObject, smartObject.ListMethods[0].ReturnProperties[0].Name);
        }
        public void SetNewMethod_WithValidSmartObject()
        {
            //Arrange
            var smartObject = SmartObjectFactory.GetSmartObject(SmartObjectOption.Users_and_Groups);

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

            // Action
            SmartObjectExtensions.SetNewMethod(smartObject, smartObject.ListMethods[0].Name, false, true);
        }
        public void SetInputPropertyValue_NoMethodToExecute()
        {
            //Arrange
            var smartObject  = SmartObjectFactory.GetSmartObject(SmartObjectOption.ProcessInfo);
            var propertyName = Guid.NewGuid().ToString();
            var value        = Guid.NewGuid().ToString();

            // Action
            SmartObjectExtensions.SetInputPropertyValue(smartObject, propertyName, value);
        }
        public void GetReturnProperty_WithNullProperty()
        {
            //Arrange
            var smartObject = SmartObjectFactory.GetSmartObject(SmartObjectOption.ProcessInfo);

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

            // Action
            SmartObjectExtensions.GetReturnProperty(smartObject, null);
        }
        public void GetReturnProperty_WithNoReturnProperties()
        {
            //Arrange
            var smartObject = SmartObjectFactory.GetSmartObject(SmartObjectOption.NoReturnProperties);

            smartObject.MethodToExecute = smartObject.AllMethods.First().Name;

            // Action
            SmartObjectExtensions.GetReturnProperty(smartObject, Guid.NewGuid().ToString());
        }
        public void SetFilter_WithValidSmartObject()
        {
            //Arrange
            var smartObject = SmartObjectFactory.GetSmartObject(SmartObjectOption.ProcessInfo);

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

            var filter = Mock.Of <Equals>();

            // Action
            SmartObjectExtensions.SetFilter(smartObject, filter);
        }
        public void GetPropertyValue_EmptyValue()
        {
            //Arrange
            var smartObject = SmartObjectFactory.GetSmartObject(SmartObjectOption.ProcessInfo);

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

            // Action
            var actual = SmartObjectExtensions.GetPropertyValue <int>(smartObject, smartObject.ListMethods[0].ReturnProperties[0].Name);

            // Assert
            Assert.AreEqual(0, actual);
        }
        public void GetPropertyValue_ValidCast()
        {
            //Arrange
            var expected    = Guid.NewGuid().ToString();
            var smartObject = SmartObjectFactory.GetSmartObject(SmartObjectOption.ProcessInfo);

            smartObject.MethodToExecute = smartObject.ListMethods[0].Name;
            smartObject.Properties[smartObject.ListMethods[0].ReturnProperties[0].Name].Value = expected;

            // Action
            var actual = SmartObjectExtensions.GetPropertyValue <string>(smartObject, smartObject.ListMethods[0].ReturnProperties[0].Name);

            // Assert
            Assert.AreEqual(expected, actual);
        }
        public void ToList_WithValidSmartObjectList()
        {
            //Arrange
            var smartObject = SmartObjectFactory.GetSmartObject(SmartObjectOption.ProcessInfo);

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

            var smartObjectList = new SmartObjectList();

            smartObjectList.SmartObjectsList.Add(smartObject);

            // Action
            var actual = SmartObjectExtensions.ToList(smartObjectList, smartObject.MethodToExecute);

            // Assert
            Assert.AreEqual(1, actual.Count());
        }