Exemplo n.º 1
0
        public void GetAllDefectDetailsByProjectNameReturnsValidResponseTest()
        {
            // Arrange
            V1ConnectionDto v1ConnectionDto = new V1ConnectionDto()
            {
                IsValid = true, ErrorMessage = string.Empty, Connection = _mockServiceConnection
            };

            _v1Service = new V1Service(_projectName, _mockConnectionHelper);
            Asset     asset  = new Asset(_mockAssetType);
            AssetList assets = new AssetList {
                asset
            };
            QueryResult result = new QueryResult(assets, 1, null);

            _mockConnectionHelper.Expect(x => x.GetV1Connection()).Return(v1ConnectionDto);
            _mockServiceConnection.Expect(x => x.Meta.GetAssetType("Defect")).IgnoreArguments().Return(_mockAssetType);
            _mockServiceConnection.Expect(x => x.Retrieve(null)).IgnoreArguments().Return(result);

            // Act
            var response = _v1Service.GetAllDefectDetailsByProjectName();

            //Assert
            Assert.IsNotNull(response);
            Assert.AreEqual(response.Count, 1);
            _mockConnectionHelper.VerifyAllExpectations();
            _mockAssetType.VerifyAllExpectations();
            _mockServiceConnection.VerifyAllExpectations();
        }
        public void ADOServiceReturnsOneWorkItemsForOneDefectAssetDtoTest()
        {
            // Arrange
            _aDOService = new ADOService(_projectName, _mockConnectionHelper);
            IList <V1DefectAssetDto> v1DefectAssetDtos = new List <V1DefectAssetDto>();
            V1DefectAssetDto         v1DefectAssetDto  = new V1DefectAssetDto()
            {
                ItemName = "Test", ItemNumber = "1"
            };

            v1DefectAssetDtos.Add(v1DefectAssetDto);

            _mockConnectionHelper.Expect(x => x.GetADOWorkItemTrackingHttpClient()).Return(null);

            // Act
            IList <WorkItem> response = _aDOService.MigrateAllV1DefectsByProjectName(v1DefectAssetDtos);

            // Assert
            Assert.IsNotNull(response);
            Assert.AreEqual(response.Count, 1);
        }