Exemple #1
0
        public EmbedBuilder FindRole(IGuildUser user, bool IsPublic)
        {
            var FakeReport  = (FakeReports.ContainsKey(user)) ? FakeReports[user] : FakeReportContext.Empty;
            var start_embed = new EmbedBuilder().WithColor(RoleMessageColor);

            if (FakeReport == FakeReportContext.Empty || !IsPublic)
            {
                start_embed = start_embed.WithTitle(RoleAssignments[user].GetType().ToString());                                                    //.WithTitle(ResMsg.GetString(RoleAssignments[user] + ""));
            }
            return(start_embed);
        }
        public void TestDeleteWhenReportNotFoundRedirects1()
        {
            #region Arrange
            Controller.ControllerContext.HttpContext = new MockHttpContext(0, new[] { "" }, "*****@*****.**");
            AccessService.Expect(a => a.HasAccess(Arg<int?>.Is.Anything, Arg<int?>.Is.Anything, Arg<string>.Is.Anything)).Return(true);
            var fakeReports = new FakeReports();
            fakeReports.Records(2, ReportRepository);
            #endregion Arrange

            #region Act
            var result = Controller.Delete(3, null, 5)
                .AssertActionRedirect()
                .ToAction<ReportController>(a => a.CallIndex(5));
            #endregion Act

            #region AssertAssert.AreEqual("Report not found.", Controller.Message);
            AccessService.AssertWasCalled(a => a.HasAccess(null, 5, "*****@*****.**"));
            Assert.IsNotNull(result);
            Assert.AreEqual(5, result.RouteValues["id"]);
            #endregion Assert
        }