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 SetUp()
 {
     base.SetUp();
     MockUserIdentityProvider.Setup(m => m.SetUserIdentity(It.IsAny <IUserIdentifiable>())).Verifiable();
     MockInventoryAdjustmentsService
     .Setup(m => m.CreateInventoryAdjustment(It.IsAny <ICreateInventoryAdjustmentParameters>()))
     .Returns(new SuccessResult <string>("123456"));
 }
예제 #3
0
            public void UtilizesUserIdentityProvider()
            {
                // Arrange
                // Act
                LotsControler.Put(LotKey, _values);

                // Assert
                MockUserIdentityProvider.Verify(m => m.SetUserIdentity(It.IsAny <ISetLotAttributeParameters>()), Times.Once());
            }
            public async void UtilizesUserIdentityProvider()
            {
                // Arrange
                var values = Fixture.Create <InventoryAdjustmentDto>();

                // Act
                await SystemUnderTest.Post(values);

                // Assert
                MockUserIdentityProvider.Verify(m => m.SetUserIdentity(values), Times.Once());
            }
예제 #5
0
            public void UtilizedUserIdentityProvider()
            {
                // arrange
                var parameters = Fixture.Create <LotHoldDto>();

                // act
                SystemUnderTest.Put("lotkey", parameters);

                // assert
                MockUserIdentityProvider.Verify(m => m.SetUserIdentity(It.IsAny <IUserIdentifiable>()), Times.Once());
            }
            public void UtilizesUserIdentityProvider()
            {
                // Arrange
                var input = Fixture.Create <CreateProductionBatchResultsDto>();

                // Act
                SystemUnderTest.Post(input);

                // Assert
                MockUserIdentityProvider.Verify(m => m.SetUserIdentity(It.IsAny <CreateProductionBatchResultsParameters>()), Times.Once());
            }
            public new void SetUp()
            {
                base.SetUp();

                MockProductionResultsService
                .Setup(m => m.UpdateProductionBatchResults(It.IsAny <IUpdateProductionBatchResultsParameters>()))
                .Returns(new SuccessResult());
                MockUserIdentityProvider.Setup(m => m.SetUserIdentity(It.IsAny <UpdateProductionBatchResultsParameters>()))
                .Returns((UpdateProductionBatchResultsParameters p) =>
                {
                    p.UserToken = "UserToken";
                    return(p);
                });
            }
예제 #8
0
            public void UtilizesUserIdentityProvider()
            {
                // Arrange
                const string newKeyValue = "newKey";
                var          postData    = Fixture.Create <CreateIntraWarehouseOrder>();

                MockIntraWarehouseOrderService.Setup(m => m.CreateIntraWarehouseOrder(It.IsAny <ICreateIntraWarehouseOrderParameters>()))
                .Returns(new SuccessResult <string>(newKeyValue));

                // Act
                SystemUnderTest.Post(postData);

                // Assert
                MockUserIdentityProvider.Verify(m => m.SetUserIdentity(It.IsAny <IUserIdentifiable>()), Times.Once());
            }
예제 #9
0
            public void AssignsUserIdentity()
            {
                // Arrange
                const string expectedUser = "******";

                MockUserIdentityProvider.Setup(m => m.SetUserIdentity(It.IsAny <IUserIdentifiable>()))
                .Callback((IUserIdentifiable u) => u.UserToken = expectedUser);
                var param = Fixture.Create <CreateMillAndWetdownRequest>();

                // Act
                SystemUnderTest.Post(param);

                // Assert
                MockUserIdentityProvider.Verify(m => m.SetUserIdentity(It.IsAny <IUserIdentifiable>()), Times.Once());
                Assert.AreEqual(expectedUser, param.UserToken);
            }
예제 #10
0
            public void UtilizesUserIdentityProvider()
            {
                // Arrange
                const string key     = "12345";
                var          putData = Fixture.Create <UpdateIntraWarehouseOrder>();
                IUpdateIntraWarehouseOrderParameters actual = null;

                MockIntraWarehouseOrderService.Setup(m => m.UpdateIntraWarehouseOrder(It.IsAny <IUpdateIntraWarehouseOrderParameters>()))
                .Callback((IUpdateIntraWarehouseOrderParameters vals) => actual = vals)
                .Returns(new SuccessResult());

                // Act
                SystemUnderTest.Put(key, putData);

                // Assert
                Assert.IsNotNull(actual);
                MockUserIdentityProvider.Verify(m => m.SetUserIdentity(actual), Times.Once());
            }
            public void UtilizesUserIdentityProvider()
            {
                // Arrange
                var data = Fixture.Create <UpdateProductionBatchResultsDto>();
                UpdateProductionBatchResultsParameters parameters = null;

                MockUserIdentityProvider.Setup(m => m.SetUserIdentity(It.IsAny <UpdateProductionBatchResultsParameters>()))
                .Callback((UpdateProductionBatchResultsParameters p) => parameters = p)
                .Returns((UpdateProductionBatchResultsParameters p) =>
                {
                    p.UserToken = "UserToken";
                    return(p);
                });

                // Act
                SystemUnderTest.Put("123", data);

                // Assert
                MockUserIdentityProvider.Verify(m => m.SetUserIdentity(parameters), Times.Once());
            }
            public void UtilizedUserIdentityProvider()
            {
                // arrange
                const string id    = "12345";
                var          input = Fixture.Create <UpdateProductionBatchParameters>();
                IUpdateProductionBatchParameters actualParams = null;

                MockUserIdentityProvider.Setup(m => m.SetUserIdentity(input))
                .Callback((IUserIdentifiable i) => i.UserToken = "user token");
                MockPackScheduleService.Setup(m => m.UpdateProductionBatch(input))
                .Callback((IUpdateProductionBatchParameters i) => actualParams = i)
                .Returns(new SuccessResult <string>("key", null));

                // act
                ControllerUnderTest.Put(id, input);

                // assert
                MockUserIdentityProvider.Verify(m => m.SetUserIdentity(input), Times.Once());
                Assert.AreEqual("user token", actualParams.UserToken);
            }
            public void UtilizesUserIdentityProvider()
            {
                // arrange
                var          input             = Fixture.Create <CreateProductionBatchDto>();
                var          @return           = Fixture.Create <CreateProductonBatchReturn>();
                const string expectedUserToken = "hello";
                var          actualUserToken   = string.Empty;

                MockUserIdentityProvider.Setup(m => m.SetUserIdentity(It.IsAny <CreateProductionBatchParameters>()))
                .Callback((IUserIdentifiable i) => i.UserToken = expectedUserToken);
                MockPackScheduleService.Setup(m => m.CreateProductionBatch(It.IsAny <ICreateProductionBatchParameters>()))
                .Callback((ICreateProductionBatchParameters p) => actualUserToken = p.UserToken)
                .Returns(new SuccessResult <ICreateProductionBatchReturn>(@return));

                // act
                ControllerUnderTest.Post(input);

                // assert
                MockUserIdentityProvider.Verify(m => m.SetUserIdentity(It.IsAny <CreateProductionBatchParameters>()), Times.Once());
                Assert.AreEqual(expectedUserToken, actualUserToken);
            }
예제 #14
0
            public void UtilizesUserIdentityProvider()
            {
                // arrange
                const string           lotKey         = "12345";
                const LotQualityStatus expectedStatus = LotQualityStatus.Released;
                var dto = new SetLotStatusDto
                {
                    Status = expectedStatus
                };
                SetLotStatusParameter actualParameters = null;

                MockUserIdentityProvider.Setup(m => m.SetUserIdentity(It.IsAny <SetLotStatusParameter>()))
                .Callback((SetLotStatusParameter p) => actualParameters = p)
                .Returns(actualParameters);
                MockLotService.Setup(m => m.SetLotQualityStatus(It.IsAny <ISetLotStatusParameters>()))
                .Returns(new SuccessResult <ILotStatInfoReturn>());

                // act
                LotsControler.SetStatus(lotKey, dto);

                // assert
                Assert.IsNotNull(actualParameters);
                MockUserIdentityProvider.Verify(m => m.SetUserIdentity(actualParameters), Times.Once());
            }