Ejemplo n.º 1
0
        public void CanSerializeGetVersions()
        {
            var getVersions = new GetVersions();
            var xml         = _serializer.Serialize(getVersions);

            Assert.AreEqual("<GetVersions />", xml);
        }
Ejemplo n.º 2
0
        public void GetVersions_Execute_ExpectName()
        {
            //------------Setup for test--------------------------
            var getVersions         = new GetVersions();
            var resourceId          = Guid.NewGuid();
            ServerExplorerItem item = new ServerExplorerItem("a", Guid.NewGuid(), ResourceType.Folder, null, Permissions.DeployFrom, "");
            var repo = new Mock <IServerVersionRepository>();
            var ws   = new Mock <IWorkspace>();

            repo.Setup(a => a.GetVersions(resourceId)).Returns(new List <IExplorerItem> {
                item
            });
            var serializer = new Dev2JsonSerializer();

            ws.Setup(a => a.ID).Returns(Guid.Empty);
            getVersions.ServerVersionRepo = repo.Object;
            //------------Execute Test---------------------------
            var ax = getVersions.Execute(new Dictionary <string, StringBuilder> {
                { "resourceId", new StringBuilder(resourceId.ToString()) }
            }, ws.Object);

            //------------Assert Results-------------------------
            repo.Verify(a => a.GetVersions(It.IsAny <Guid>()));
            Assert.AreEqual(serializer.Deserialize <IList <IExplorerItem> >(ax.ToString())[0].ResourceId, item.ResourceId);
        }
Ejemplo n.º 3
0
        public void GetVersions_HandlesType_ExpectName()
        {
            //------------Setup for test--------------------------
            var getVersions = new GetVersions();


            //------------Execute Test---------------------------

            //------------Assert Results-------------------------
            Assert.AreEqual("GetVersions", getVersions.HandlesType());
        }
Ejemplo n.º 4
0
        public void GetAuthorizationContextForService_ShouldReturnContext()
        {
            //------------Setup for test--------------------------
            var getVersions = new GetVersions();

            //------------Execute Test---------------------------
            var resId = getVersions.GetAuthorizationContextForService();

            //------------Assert Results-------------------------
            Assert.AreEqual(AuthorizationContext.Any, resId);
        }
Ejemplo n.º 5
0
        public void GetResourceID_ShouldReturnEmptyGuid()
        {
            //------------Setup for test--------------------------
            var getVersions = new GetVersions();

            //------------Execute Test---------------------------
            var resId = getVersions.GetResourceID(new Dictionary <string, StringBuilder>());

            //------------Assert Results-------------------------
            Assert.AreEqual(Guid.Empty, resId);
        }
Ejemplo n.º 6
0
        public void GetVersions_Execute_NullValuesParameter_ErrorResult()
        {
            //------------Setup for test--------------------------
            var getVersions = new GetVersions();
            var serializer  = new Dev2JsonSerializer();
            //------------Execute Test---------------------------
            StringBuilder             jsonResult = getVersions.Execute(null, null);
            IExplorerRepositoryResult result     = serializer.Deserialize <IExplorerRepositoryResult>(jsonResult);

            //------------Assert Results-------------------------
            Assert.AreEqual(ExecStatus.Fail, result.Status);
        }
Ejemplo n.º 7
0
        public void GetVersions_CreateServiceEntry_ExpectProperlyFormedDynamicService()
        {
            //------------Setup for test--------------------------
            var getVersions = new GetVersions();


            //------------Execute Test---------------------------
            var a = getVersions.CreateServiceEntry();
            //------------Assert Results-------------------------
            var b = a.DataListSpecification.ToString();

            Assert.AreEqual(@"<DataList><ResourceType ColumnIODirection=""Input""/><Roles ColumnIODirection=""Input""/><ResourceId ColumnIODirection=""Input""/><Dev2System.ManagmentServicePayload ColumnIODirection=""Both""></Dev2System.ManagmentServicePayload></DataList>", b);
        }
Ejemplo n.º 8
0
      internal void Handle(GetVersions input) {
         var result = new ResultSet<UpdateTypeVersion>();

         using (var dbConn = DatabaseManager.DbConn()) {
            var versions = dbConn.ExecuteBpl(
               new VersionGetForClient { 
                  Operator = input.Operator,
                  DriverId = input.DriverId,
                  DeviceId = input.DeviceId
               });

            foreach (var ver in versions) {
               if (input.UpdateTypes.Contains(ver.UpdateType)) {
                  result.result.Add(
                     new UpdateTypeVersion {
                        UpdateType = ver.UpdateType,
                        Version = new TimeStamp(ver.UpdateVersion)
                     });
               }
            }
         }

         Reply(result);
      }
Ejemplo n.º 9
0
        /// <summary>
        /// This request is sent from the client to the OMM to request the versions of requests/responses or events.
        /// </summary>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public Task <GetVersionsResp> GetVersionsAsync(CancellationToken cancellationToken)
        {
            var getversions = new GetVersions();

            return(SendAsync <GetVersions, GetVersionsResp>(getversions, cancellationToken));
        }
        public NuGetPackageDetailViewModel()
        {
            GetVersions = ReactiveCommand.CreateFromTask <IPackageSearchMetadata, IEnumerable <NuGetVersionViewModel> >(ExecuteGetVersions);

            _versions = GetVersions.ToProperty(this, x => x.Versions, scheduler: RxApp.MainThreadScheduler);
        }