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

            AssemblyInit.RegisterFactorySettings();
            Assert.IsTrue(MovieDbFactory.IsFactoryComposed);
        }
Ejemplo 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.");
        }
Ejemplo 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();
            }
        }