Esempio n. 1
0
        public void ResetFactory_SetsIsFactoryComposed()
        {
            MovieDbFactory.ResetFactory();
            Assert.IsFalse(MovieDbFactory.IsFactoryComposed);

            AssemblyInit.RegisterFactorySettings();
            Assert.IsTrue(MovieDbFactory.IsFactoryComposed);
        }
Esempio n. 2
0
        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.");
        }
Esempio n. 3
0
        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();
            }
        }