public void CreateFolder_Execute_ExpectCreateCalled() { //------------Setup for test-------------------------- var createFolderService = new AddFolderService(); var item = new ServerExplorerItem("a", Guid.NewGuid(), "Folder", null, Permissions.DeployFrom, ""); item.ResourcePath = @"root\"; var repo = new Mock <IExplorerServerResourceRepository>(); var ws = new Mock <IWorkspace>(); repo.Setup(a => a.AddItem(item, It.IsAny <Guid>())).Returns(new ExplorerRepositoryResult(ExecStatus.Fail, "noddy")); var serializer = new Dev2JsonSerializer(); var inputs = new Dictionary <string, StringBuilder> { { "itemToAdd", serializer.SerializeToBuilder(item) } }; ws.Setup(a => a.ID).Returns(Guid.Empty); createFolderService.ServerExplorerRepo = repo.Object; //------------Execute Test--------------------------- createFolderService.Execute(inputs, ws.Object); //------------Assert Results------------------------- repo.Verify(a => a.AddItem(It.IsAny <IExplorerItem>(), It.IsAny <Guid>())); }
public void CreateFolder_HandlesType_ExpectName() { //------------Setup for test-------------------------- var addFolder = new AddFolderService(); //------------Execute Test--------------------------- //------------Assert Results------------------------- Assert.AreEqual("AddFolderService", addFolder.HandlesType()); }
public void GetResourceID_ShouldReturnEmptyGuid() { //------------Setup for test-------------------------- var service = new AddFolderService(); //------------Execute Test--------------------------- var resId = service.GetResourceID(new Dictionary <string, StringBuilder>()); //------------Assert Results------------------------- Assert.AreEqual(Guid.Empty, resId); }
public void GetAuthorizationContextForService_ShouldReturnContext() { //------------Setup for test-------------------------- var service = new AddFolderService(); //------------Execute Test--------------------------- var resId = service.GetAuthorizationContextForService(); //------------Assert Results------------------------- Assert.AreEqual(AuthorizationContext.Contribute, resId); }
public void CreateFolder_CreateServiceEntry_ExpectProperlyFormedDynamicService() { //------------Setup for test-------------------------- var createFolder = new AddFolderService(); //------------Execute Test--------------------------- var a = createFolder.CreateServiceEntry(); //------------Assert Results------------------------- var b = a.DataListSpecification.ToString(); Assert.AreEqual("<DataList><itemToAdd ColumnIODirection=\"Input\"/><Dev2System.ManagmentServicePayload ColumnIODirection=\"Both\"></Dev2System.ManagmentServicePayload></DataList>", b); }