public void CanSerializeGetVersions() { var getVersions = new GetVersions(); var xml = _serializer.Serialize(getVersions); Assert.AreEqual("<GetVersions />", xml); }
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); }
public void GetVersions_HandlesType_ExpectName() { //------------Setup for test-------------------------- var getVersions = new GetVersions(); //------------Execute Test--------------------------- //------------Assert Results------------------------- Assert.AreEqual("GetVersions", getVersions.HandlesType()); }
public void GetAuthorizationContextForService_ShouldReturnContext() { //------------Setup for test-------------------------- var getVersions = new GetVersions(); //------------Execute Test--------------------------- var resId = getVersions.GetAuthorizationContextForService(); //------------Assert Results------------------------- Assert.AreEqual(AuthorizationContext.Any, resId); }
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); }
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); }
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); }
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); }
/// <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); }