Ejemplo n.º 1
0
    public void AuthorCode_WithClassName_CreatesClassForName(string className)
    {
        // Arrange
        var transcriber = new AddressableRegisterTranscriber();

        // Act
        var code = transcriber.AuthorCode(className);

        // Assert
        Assert.That(code.Contains($"public class {className}"));
    }
Ejemplo n.º 2
0
    public void AuthorCode_WithAssetGroup_CreatesEnumForGroup(string groupName, string assetName)
    {
        // Arrange
        var mockAssetProvider = SubstituteAssetProvider(groupName, assetName);
        var transcriber       = new AddressableRegisterTranscriber(mockAssetProvider);

        // Act
        var code = transcriber.AuthorCode("AddressableRegister");

        // Assert
        Assert.That(code.Contains($"public enum {groupName}"));
        Assert.That(code.Contains($"{assetName} = 0,"));
    }
Ejemplo n.º 3
0
    public void AuthorCode_WheneverRun_MarksClassWithAssetProviderAttribute()
    {
        // Arrange
        var transcriber = new AddressableRegisterTranscriber();

        // Act
        var code = transcriber.AuthorCode("Test");

        // Assert
        var attributeStr = $"[{nameof(AddressableRegisterAttribute)}]";

        attributeStr = attributeStr.Replace("Attribute", String.Empty);
        Assert.That(code.Contains(attributeStr));
    }