public void ResetFactory_SetsIsFactoryComposed() { MovieDbFactory.ResetFactory(); Assert.IsFalse(MovieDbFactory.IsFactoryComposed); AssemblyInit.RegisterFactorySettings(); Assert.IsTrue(MovieDbFactory.IsFactoryComposed); }
public void Create_Throws_InvalidOperationException_When_SettingsNotRegistered() { try { MovieDbFactory.ResetFactory(); MovieDbFactory.Create <IMockApiRequest>(); } catch (InvalidOperationException) { return; } finally { // keeps all other tests running since the settings are registered in AssemblyInit for all tests. AssemblyInit.RegisterFactorySettings(); } Assert.Fail("InvalidOperationException was expected."); }
public async Task RegisterSettings_CanUse_RawStrings() { try { MovieDbFactory.ResetFactory(); MovieDbFactory.RegisterSettings(AssemblyInit.Settings.ApiKey, AssemblyInit.Settings.ApiUrl); var api = MovieDbFactory.Create <IApiMovieRequest>().Value; ApiQueryResponse <Movie> response = await api.GetLatestAsync(); Assert.IsNull(response.Error); Assert.IsNotNull(response.Item); Assert.IsTrue(response.Item.Id > 391000); } finally { // keeps all other tests running since the settings are registered in AssemblyInit for all tests. AssemblyInit.RegisterFactorySettings(); } }