100coding
4/7/2017 - 1:44 AM

1B20C185-F189-4B64-91A6-1AC93046E8D8

1B20C185-F189-4B64-91A6-1AC93046E8D8

using Zenject;
using NUnit.Framework;

[TestFixture]
public class TestLogger : ZenjectUnitTestFixture
{
    [SetUp]
    public void Common_install()
    {
        Container.Bind<Logger>().AsSingle();
        Container.Inject(this);
    }

    [Inject] private Logger logger;

    [Test]
    public void Test_initial_values()
    {
        Assert.That(this.logger.Log == "");
    }

    [Test]
    public void Test_first_entry()
    {
        this.logger.Write("foo");
        Assert.That(this.logger.Log == "foo");
    }

    [Test]
    public void Test_append()
    {
        this.logger.Write("foo");
        this.logger.Write("bar");

        Assert.That(this.logger.Log == "foobar");
    }

    [Test]
    [ExpectedException]
    public void Test_null_value()
    {
        this.logger.Write(null);
    }
}