public void TestMapFromContextWithItem() { var testingClass = new UpdateOfItemEntityConsumer(serviceContextMock, mapperMock, _logger.Object); testingClass.MapFromContext(this.context.Object, this.ArgumentItem); Assert.AreEqual(ArgumentItem.Name, DesiredItem.Name); Assert.AreEqual(ArgumentItem.Price, DesiredItem.Price); }
public void TestCheckForSuitabilityWithIncorrectValueRelationNo() { var testingClass = new UpdateOfItemEntityConsumer(serviceContextMock, mapperMock, _logger.Object); context.Setup(p => p.Message.RelationNo).Returns(0); //Only one not set in setup (not needed for most tests here) var result = testingClass.CheckForSuitability(context.Object); Assert.IsFalse(result); }
public void TestMapFromContextWithItemPriceAndCurrencyResponse() { //Most of the setup is done in [SetUp] //Actual class is set up here, as to not interfere with changes due to non-conformity //Arrange var testingClass = new UpdateOfItemEntityConsumer(serviceContextMock, mapperMock, _logger.Object); //Act testingClass.MapFromContext(this.context.Object, this.ArgumentModel); //Assert //Since the overloaded function with argument ItemPriceAndCurrencyResponse, //, we can assert for the full equality of the test and desired model //We assert only for equality in non-key references, since the update function does // change relations Assert.AreEqual(ArgumentModel.Currency, DesiredModel.Currency); Assert.AreEqual(ArgumentItem.Name, DesiredItem.Name); Assert.AreEqual(ArgumentItem.Price, DesiredItem.Price); }