Exemplo n.º 1
0
        public MainForm()
        {
            InitializeComponent();

            var binding = new BasicHttpBinding();
            var address = new EndpointAddress("http://rentit.itu.dk/rentit01/RentItService.svc");
            rentItProxy = new RentItClient(binding, address);

            // Call a method on the web service to check for connectivity.
            // A potential EndpointNotFoundException is caught in Program.cs.
            rentItProxy.GetAllGenres(MediaType.Book);

            TopBar.RentItProxy = rentItProxy;
            TopBar.Credentials = credentials;
            TopBar.ContentChangeEvent += ChangeContent;
            TopBar.CredentialsChangeEvent += ChangeCredentials;
            TopBar.CreditsChangeEvent += ChangeCredits;

            Content = new MainScreen { RentItProxy = rentItProxy };
        }
Exemplo n.º 2
0
        public void GetAllGenresTest()
        {
            RentItClient target = new RentItClient();
            MediaType mediaType = MediaType.Any;
            string[] expected = new string[0]; // empty list
            string[] actual = target.GetAllGenres(mediaType); // List<string> actual = target.GetAllGenres(mediaType);
            Assert.AreNotEqual(expected.Length, actual.Length); // list should not be empty

            mediaType = MediaType.Book;
            actual = target.GetAllGenres(mediaType);
            Assert.AreNotEqual(expected.Length, actual.Length); // list should not be empty

            mediaType = MediaType.Movie;
            actual = target.GetAllGenres(mediaType);
            Assert.AreNotEqual(expected.Length, actual.Length); // list should not be empty

            mediaType = MediaType.Album;
            actual = target.GetAllGenres(mediaType);
            Assert.AreNotEqual(expected.Length, actual.Length); // list should not be empty

            mediaType = MediaType.Song;
            actual = target.GetAllGenres(mediaType);
            Assert.AreNotEqual(expected.Length, actual.Length); // list should not be empty
        }