public void Contact_Mapping_All_SubScriptionStates_Tests() { var mapper = AutoMapperConfiguration.BuildMapperConfiguration(); var rosterItem = new RosterItem { Name = "Alex", Jid = "*****@*****.**", Subscription = Subscription.Both }; var contact = mapper.Map <MatrixClient.ViewModel.Contact>(rosterItem); contact.Subscription.ShouldBe(MatrixClient.ViewModel.Subscription.Both); var rosterItem2 = new RosterItem { Name = "Alex", Jid = "*****@*****.**", Subscription = Subscription.None }; var contact2 = mapper.Map <MatrixClient.ViewModel.Contact>(rosterItem2); contact2.Subscription.ShouldBe(MatrixClient.ViewModel.Subscription.None); var rosterItem3 = new RosterItem { Name = "Alex", Jid = "*****@*****.**", Subscription = Subscription.To }; var contact3 = mapper.Map <MatrixClient.ViewModel.Contact>(rosterItem3); contact3.Subscription.ShouldBe(MatrixClient.ViewModel.Subscription.To); var rosterItem4 = new RosterItem { Name = "Alex", Jid = "*****@*****.**", Subscription = Subscription.From }; var contact4 = mapper.Map <MatrixClient.ViewModel.Contact>(rosterItem4); contact4.Subscription.ShouldBe(MatrixClient.ViewModel.Subscription.From); }
public void Contact_Mapping_Test_When_Name_Is_Missing_Should_Default_To_Jid() { var mapper = AutoMapperConfiguration.BuildMapperConfiguration(); var rosterItem = new RosterItem { Jid = "*****@*****.**" }; var contact = mapper.Map <MatrixClient.ViewModel.Contact>(rosterItem); contact.Jid.ShouldBe("*****@*****.**"); contact.Name.ShouldBe("*****@*****.**"); }
public void Contact_Mapping_Tests() { var mapper = AutoMapperConfiguration.BuildMapperConfiguration(); var rosterItem = new RosterItem { Name = "Alex", Jid = "*****@*****.**", Subscription = Subscription.None }; var contact = mapper.Map <MatrixClient.ViewModel.Contact>(rosterItem); contact.Jid.ShouldBe("*****@*****.**"); contact.Name.ShouldBe("Alex"); contact.Subscription.ShouldBe(MatrixClient.ViewModel.Subscription.None); }
public void Message_Mapping_Test() { var mapper = AutoMapperConfiguration.BuildMapperConfiguration(); var message = new Message { From = "*****@*****.**", Body = "Foo" }; var viewMessage = mapper.Map <MatrixClient.ViewModel.Message>(message); viewMessage.Text.ShouldBe("Foo"); viewMessage.Id.ShouldBeNull(); message.Id = "12345"; var viewMessage2 = mapper.Map <MatrixClient.ViewModel.Message>(message); viewMessage2.Id.ShouldBe("12345"); }