public void ItShouldGetOneAttachment()
        {
            var mockProxy = new Mock<ITFSAttachmentProxy>();

            var expectedResult = new Attachment
            {
                Id = "29161-0",
                WorkItemId = 29161,
                Index = 0,
                Name = "Sample File 1.txt",
                Extension = "txt",
                Comment = "Sample Comment 1",
                Length = 1024,
                AttachedTime = DateTime.Now,
                CreationTime = DateTime.Now,
                LastWriteTime = DateTime.Now,
                Uri = "http://sampleuri/"
            };

            mockProxy.Setup(p => p.GetAttachment(It.Is<int>(id => id == 29161), It.Is<int>(index => index == 0)))
                .Returns(expectedResult)
                .Verifiable();

            var repository = new AttachmentRepository(mockProxy.Object);

            var result = repository.GetOne("29161-0");

            Assert.AreEqual(result, expectedResult);
            mockProxy.VerifyAll();
        }
        public void ItShouldGetOneEmptyAttachmentIsIdStartsWithTemp()
        {
            var mockProxy = new Mock<ITFSAttachmentProxy>();
            var repository = new AttachmentRepository(mockProxy.Object);
            var tempId = "temp-123456789";

            var result = repository.GetOne(tempId);

            Assert.IsNotNull(result);
            Assert.AreEqual(result.Id, tempId);
        }
        public void ItShouldThrowIfIndexIsNotANumberInGetOneAttachment()
        {
            var mockProxy = new Mock<ITFSAttachmentProxy>();
            var repository = new AttachmentRepository(mockProxy.Object);
            var badId = "29161-NAN";

            repository.GetOne(badId);
        }
        public void ItShouldThrowIfWorkItemIdIsNotANumberInGetOneAttachment()
        {
            var mockProxy = new Mock<ITFSAttachmentProxy>();
            var repository = new AttachmentRepository(mockProxy.Object);
            var badId = "NAN-0";

            repository.GetOne(badId);
        }
        public void ItShouldThrowIfAttachmenIdIsNotWellFormatted2()
        {
            var mockProxy = new Mock<ITFSAttachmentProxy>();
            var repository = new AttachmentRepository(mockProxy.Object);
            var badId = "123-456-789";

            var result = repository.GetOne(badId);
        }