I do have appsettings.json file in the unit test project. However I get the error "Object reference not set to an instance of an object".
[Fact] public void Given_AppSettings_Should_Return_Positive_Integer() { var logger = new Mock<ILogger>().Object; var deviceInformationGetter = new DeviceInformationGetter(logger); var builderMock = new Mock<ConfigurationBuilder>(); var builder = builderMock.Object; builder.AddJsonFile("appsettings.json"); // here error var configuration = builder.Build(); var result = deviceInformationGetter.GetMaxRetryTimesFromAppSettings(configuration); Assert.True(result > 0); }
In my project.json file I do have
"Microsoft.Framework.Configuration": "1.0.0-beta8"
Thanks.