コード例 #1
0
        public void ShouldUseSpecifiedWindowsStoreGateway()
        {
            var mockGateway = new StoreGatewayMoqaLate();
            mockGateway.IsPurchasedSetReturnValue(true);

            var sut = new SinglePurchase1
                          {
                              StoreGateway = mockGateway
                          };

            var result = sut.IsPurchased;

            Assert.True(mockGateway.IsPurchasedWasCalledWith("SinglePurchase1"));
            Assert.True(result);
        }
コード例 #2
0
        public void ShouldReturnIfSpecificInstanceHasBeenPurchased()
        {
            var mockGateway = new StoreGatewayMoqaLate();
             mockGateway.IsPurchasedSetReturnValue(true);

             var sut = new RepeatPurchaseWith123Instances()
             {
                 StoreGateway = mockGateway
             };

             var isPurchased = sut.IsInstancePurchased(123);

             Assert.True(isPurchased);

             // TODO: this should prob be in sep test
             // Due to current limitations with MoqaLate, we can only get what the last call was for a particular method
             mockGateway.IsPurchasedWasCalledWith("MultiFeatureWith123Instances_123");

             // test the negative version
             mockGateway.IsPurchasedSetReturnValue(false);

             isPurchased = sut.IsInstancePurchased(123);

             Assert.False(isPurchased);

             // TODO: this should prob be in sep test
             // Due to current limitations with MoqaLate, we can only get what the last call was for a particular method
             mockGateway.IsPurchasedWasCalledWith("RepeatPurchaseWith123Instances_123");
        }