Exemplo n.º 1
0
        public void DdpCollection_RemoveAsync_NullItem()
        {
            var remoteMethodCall = new Mock<IDdpRemoteMethodCall>();
            var collection = new DdpCollection<TestDdpObject>(remoteMethodCall.Object, "TestCollection");

            PCLTesting.ExceptionAssert.Throws<ArgumentNullException>(() => collection.RemoveAsync(null));
        }
Exemplo n.º 2
0
        public void DdpCollection_RemoveAsync_CallsServerMethod()
        {
            var remoteMethodCall = new Mock<IDdpRemoteMethodCall>();
            var collection = new DdpCollection<TestDdpObject>(remoteMethodCall.Object, "TestCollection");

            var testObject = new TestDdpObject() {Id = "1", integerField = 10, StringProperty = "FooBar"};

            remoteMethodCall.Setup(x => x.Call<int>(It.IsAny<string>(), It.IsAny<object[]>()))
                .Returns(Task.FromResult(1));

            collection.RemoveAsync(testObject.Id).Wait();

            remoteMethodCall.Verify(
                x =>
                    x.Call<int>(It.Is<string>(s => s.Equals(@"/TestCollection/remove")),
                        It.Is<object[]>(c => c.Length == 1 && ((IdParameter) c.First()).Id == "1")));
        }