Exemplo n.º 1
0
    public void Returns_Formatted_String()
    {
        // Arrange
        var version = Setup.NewVersion;

        // Act
        var result = VersionF.GetVersionString(version);

        // Assert
        Assert.Equal($"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}", result);
    }
Exemplo n.º 2
0
    public async Task Stream_Null_Returns_Version()
    {
        // Arrange
        var version  = Setup.NewVersion;
        var expected = VersionF.GetVersionString(version);

        // Act
        var result = await VersionF.GetVersion(null, version);

        // Assert
        Assert.Equal(expected, result);
    }
Exemplo n.º 3
0
    public async Task Stream_Not_Null_Catches_Stream_Exception_Returns_Version()
    {
        // Arrange
        var stream = new MemoryStream();

        stream.Dispose();         // causes StreamReader.ReadToEndAsync() to throw an exception
        var version  = Setup.NewVersion;
        var expected = VersionF.GetVersionString(version);

        // Act
        var result = await VersionF.GetVersion(stream, version);

        // Assert
        Assert.Equal(expected, result);
    }