public void UtilizesUserIdentityProvider() { // arrange const string custKey = "1234"; const string productKey = "asdf"; var values = AutoFixtureHelper.BuildFixture().Create <SetCustomerProductRangesRequest>(); const string expectedUserToken = "USER123"; MockUserIdentityProvider.Setup(m => m.SetUserIdentity(It.IsAny <IUserIdentifiable>())) .Callback((IUserIdentifiable t) => { t.UserToken = expectedUserToken; }); ISetCustomerProductAttributeRangesParameters actualValues = null; MockCustomerService.Setup(m => m.SetCustomerChileProductAttributeRanges(It.IsAny <ISetCustomerProductAttributeRangesParameters>())) .Callback((ISetCustomerProductAttributeRangesParameters p) => actualValues = p) .Returns(new SuccessResult()); // act SystemUnderTest.Post(custKey, productKey, values); // assert Assert.IsNotNull(actualValues); Assert.AreEqual(expectedUserToken, actualValues.UserToken); }
public void Tests() { // arrange var expectedResult = AutoFixtureHelper.BuildFixture().Create <ICustomerChileProductAttributeRangesReturn>(); MockCustomerService.Setup(m => m.GetCustomerChileProductAttributeRanges(It.IsAny <string>(), It.IsAny <string>())) .Returns(new SuccessResult <ICustomerChileProductAttributeRangesReturn>(expectedResult)); // act SystemUnderTest.Get("1234", "asdf"); Assert.Pass(); }
public void ParametersAreCorrectlyParsedIntoDataTransferObject() { // arrange const string custKey = "1234"; const string productKey = "asdf"; var values = AutoFixtureHelper.BuildFixture().Create <SetCustomerProductRangesRequest>(); ISetCustomerProductAttributeRangesParameters actualValues = null; MockCustomerService.Setup(m => m.SetCustomerChileProductAttributeRanges(It.IsAny <ISetCustomerProductAttributeRangesParameters>())) .Callback((ISetCustomerProductAttributeRangesParameters p) => actualValues = p) .Returns(new SuccessResult()); // act SystemUnderTest.Post(custKey, productKey, values); // assert Assert.IsNotNull(actualValues); Assert.AreEqual(custKey, actualValues.CustomerKey); Assert.AreEqual(productKey, productKey); }
public void ParametersAreMappedAsExpected() { // arrange const string customerKey = "1234"; const string chileProductKey = "asdf"; IRemoveCustomerChileProductAttributeRangesParameters actualParams = null; MockCustomerService.Setup(m => m.RemoveCustomerChileProductAttributeRanges(It.IsAny <IRemoveCustomerChileProductAttributeRangesParameters>())) .Callback((IRemoveCustomerChileProductAttributeRangesParameters p) => actualParams = p) .Returns(new SuccessResult()); // act SystemUnderTest.Delete(customerKey, chileProductKey); // assert MockCustomerService.Verify(m => m.GetCustomerChileProductAttributeRanges(customerKey, chileProductKey), Times.Once()); Assert.IsNotNull(actualParams); Assert.AreEqual(customerKey, actualParams.CustomerKey); Assert.AreEqual(chileProductKey, actualParams.ChileProductKey); }