示例#1
0
        public void DefinitionPassbookContainsService()
        {
            ServiceCollection services = new ServiceCollection();
            DefinitionTests.DefinePassbook(services);

            Assert.AreEqual(1, services.Count);
            Assert.IsNotNull(services.CurrentService);
            Assert.AreEqual(services.Last(), services.CurrentService);
            Assert.AreEqual("Passbook", services.CurrentService.Name);
        }
示例#2
0
        public void DefinitionPassbookContainsGetLatestVersionOfPassEndpointAndMethods()
        {
            ServiceCollection services = new ServiceCollection();
            DefinitionTests.DefinePassbook(services);

            EndpointCollection endpoints = services.Last().Endpoints as EndpointCollection;
            Assert.IsNotNull(endpoints);
            Assert.IsTrue(endpoints.Any());
            Assert.AreEqual("v1/passes/{passTypeIdentifier}/{serialNumber}", endpoints.First().Route.ToString());

            MethodCollection methods = endpoints.First().Methods as MethodCollection;
            Assert.IsNotNull(methods);
            Assert.AreEqual(1, methods.Count());
            Assert.AreEqual(MethodType.Get, methods.First().MethodType);
        }
示例#3
0
        public void DefinitionPassbookContainsDeviceUnregistrationEndpointAndMethods()
        {
            ServiceCollection services = new ServiceCollection();
            DefinitionTests.DefinePassbook(services);

            EndpointCollection endpoints = services.Last().Endpoints as EndpointCollection;
            Assert.IsNotNull(endpoints);
            Assert.IsTrue(3 <= endpoints.Count());
            Assert.AreEqual("v1/devices/{deviceLibraryIdentifier}/registrations/{passTypeIdentifier}/{serialNumber}", endpoints.ElementAt(2).Route.ToString());

            MethodCollection methods = endpoints.ElementAt(2).Methods as MethodCollection;
            Assert.IsNotNull(methods);
            Assert.AreEqual(1, methods.Count());
            Assert.AreEqual(MethodType.Delete, methods.First().MethodType);
        }