public void Empty_ShouldCreateSingleOrEmptyWithNoElements()
        {
            // Arrange
            // Act
            var actual = SingleOrEmpty.Empty <int>();

            // Assert
            Assert.That(actual, Is.Empty);
        }
        public void Single_ShouldCreateSingleOrEmptyWithSingleElement()
        {
            // Arrange
            var element = Guid.NewGuid();

            // Act
            var actual = SingleOrEmpty.Single(element);

            // Assert
            Assert.That(actual, Has.One.Items);
            Assert.That(actual.Single(), Is.EqualTo(element));
        }
Example #3
0
        private static ISingleOrEmpty <AssetInfo> TryGetAssetInfoFromFile(IFile file)
        {
            if (!AssetFileUtils.IsAssetFile(file.Path))
            {
                return(SingleOrEmpty.Empty <AssetInfo>());
            }

            using var fileStream = file.OpenRead();
            var assetData = AssetData.Load(fileStream);
            var assetInfo = new AssetInfo(assetData.AssetId, assetData.AssetType, file.Path);

            return(SingleOrEmpty.Single(assetInfo));
        }