Ejemplo n.º 1
0
        public void AssociateArtifactTest()
        {
            var returnArtifact = new BuildArtifact();
            var token          = new CancellationToken();
            var guid           = Guid.NewGuid();
            var service        = new BuildService(_mockClientFactory.Object, guid);

            _mockBuildClient.Setup(x => x.CreateArtifactAsync(
                                       It.Is <BuildArtifact>(a => a.Name == "name" && a.Resource.Data == "data" && a.Resource.Type == "type" && a.Resource.Properties["key"] == "value"),
                                       It.Is <Guid>(b => b == guid),
                                       It.Is <int>(c => c == 1234),
                                       It.IsAny <object>(),
                                       It.Is <CancellationToken>(d => d == token)))
            .Returns(Task.FromResult(returnArtifact));

            var artifact = service.AssociateArtifact(1234, "name", "type", "data", new Dictionary <string, string>()
            {
                { "key", "value" }
            }, token).Result;

            Assert.AreEqual(artifact, returnArtifact);
        }