Example #1
0
        public void FindByUriFirstOrDefaultTest()
        {
            string testMessageId     = Guid.NewGuid().ToString();
            string testFileUri       = $"c:/temp/{Path.GetRandomFileName()}";
            FileObjectCollection foc = new FileObjectCollection();

            foc.AddRange(new FileObject[4]
            {
                new FileObject()
                {
                    Status = FileStatus.uploading, MessageId = null
                },
                new FileObject()
                {
                    Status = FileStatus.downloading, MessageId = testMessageId, FileUri = testFileUri
                },
                new FileObject()
                {
                    Status = FileStatus.downloading, MessageId = Guid.NewGuid().ToString(), FileUri = $"c:/temp/{Path.GetRandomFileName()}"
                },
                new FileObject()
                {
                    Status = FileStatus.failed, MessageId = Guid.NewGuid().ToString(), FileUri = $"c:/temp/{Path.GetRandomFileName()}"
                },
            });
            Assert.IsTrue(foc.FindByUriFirstOrDefault(testFileUri).MessageId == testMessageId & foc.FindByUriFirstOrDefault(testFileUri).FileUri == testFileUri);
        }