In() 공개 메소드

public In ( FileSizeUnit newUnit ) : FileSize
newUnit FileSizeUnit
리턴 FileSize
예제 #1
0
        public void CanConvertBetweenUnitsWhenSizeIs1060111()
        {
            var originalSize = 1060111;
            var sizeInBytes = new FileSize(originalSize);
            var sizeInKBytes = sizeInBytes.In(FileSizeUnit.KB);
            var sizeInMBytes = sizeInBytes.In(FileSizeUnit.MB);

            sizeInBytes.Equals(originalSize).Should().Be.True();
            sizeInKBytes.Equals(originalSize).Should().Be.True();
            sizeInMBytes.Equals(originalSize).Should().Be.True();

            sizeInKBytes.Equals(sizeInBytes).Should().Be.True();
            sizeInMBytes.Equals(sizeInBytes).Should().Be.True();

            sizeInMBytes.Equals(sizeInKBytes).Should().Be.True();

            sizeInMBytes.ToString(CultureInfo.InvariantCulture).Should().Be("1.01 MB");
            sizeInMBytes.ToString("0.###", CultureInfo.InvariantCulture).Should().Be("1.011 MB");
        }
예제 #2
0
        public void CanHashCodeWhenSizeIs1034AndCultureIsPT_BR()
        {
            var originalSize = 1034;
            var sizeInBytes = new FileSize(originalSize);
            var sizeInKBytes = sizeInBytes.In(FileSizeUnit.KB);

            sizeInBytes.Equals(originalSize).Should().Be.True();
            sizeInKBytes.Equals(originalSize).Should().Be.True();

            sizeInKBytes.Equals(sizeInBytes).Should().Be.True();

            sizeInKBytes.ToString(CultureInfo.GetCultureInfo("pt-BR")).Should().Be("1,01 KB");
        }