Beispiel #1
0
        public void ThrowsExceptionOnUnknownRouteForSingle(object route)
        {
            // prepare
            var attachment = UNNotificationAttachment.FromIdentifier(
                Guid.NewGuid().ToString(),
                NSUrl.FromFilename("filename"),
                new UNNotificationAttachmentOptions(),
                out var error);
            var router = new IOsImageRouter();
            var mock   = new Mock <IPlatformSpecificExtension>();
            var ims    = new SealedToastImageSource(attachment);

            // act && verify
            Assert.Throws <InvalidOperationException>(() => router.Configure(mock.Object, ims, (Router.Route)route));
        }
Beispiel #2
0
        public void ConfigureSingle(object route)
        {
            // prepare
            var attachment = UNNotificationAttachment.FromIdentifier(
                Guid.NewGuid().ToString(),
                NSUrl.FromFilename("filename"),
                new UNNotificationAttachmentOptions(),
                out var error);
            var router           = new IOsImageRouter();
            var mock             = new Mock <IPlatformSpecificExtension>();
            ToastImageSource ims = new SealedToastImageSource(attachment);

            // act
            router.Configure(mock.Object, ims, (Router.Route)route);

            // verify
            mock.Assert(_ => _.AddAttachment(attachment));
        }
Beispiel #3
0
        public void ConfigureMultiple(object route)
        {
            // prepare
            var attachment = UNNotificationAttachment.FromIdentifier(
                Guid.NewGuid().ToString(),
                NSUrl.FromFilename("filename"),
                new UNNotificationAttachmentOptions(),
                out var error);
            var router           = new IOsImageRouter();
            var mock             = new Mock <IPlatformSpecificExtension>();
            ToastImageSource ims = new SealedToastImageSource(attachment);
            var many             = Enumerable.Repeat(ims, 10);

            // act
            router.Configure(mock.Object, many, (Router.Route)route);

            // verify
            mock.Assert(_ => _.AddAttachments(The <IEnumerable <UNNotificationAttachment> > .Is(e => e.All(i => i == attachment))));
        }